Skip to content

Adds recursion limit into FindParamInClause#152800

Open
spirali wants to merge 3 commits intorust-lang:mainfrom
spirali:fix-FindParamInClause
Open

Adds recursion limit into FindParamInClause#152800
spirali wants to merge 3 commits intorust-lang:mainfrom
spirali:fix-FindParamInClause

Conversation

@spirali
Copy link
Contributor

@spirali spirali commented Feb 18, 2026

Fixes #152716

r? lcnr

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Feb 18, 2026
@rustbot

This comment was marked as outdated.

@rustbot rustbot assigned lcnr and unassigned fmease Feb 18, 2026
ty.super_visit_with(self)
self.recursion_depth += 1;
if self.recursion_depth > self.ecx.cx().recursion_limit() {
return ControlFlow::Break(Err(NoSolution));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this means that we don't consider this where-bound at all, but we should consider it, just as overflow. Change the type Result to be an Result<Certainty, NoSolution> and propagate the certainty back up (conservatively treating where-bounds which overflow as non-global)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -0,0 +1,17 @@
//@ compile-flags: -Znext-solver

// Regression test for <https://github.com/rust-lang/rust/issues/152716>.
Copy link
Contributor

@lcnr lcnr Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a line or two explaining what this is testing/why it was wrong before

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comment

I: Interner,
{
type Result = ControlFlow<Result<(), NoSolution>>;
type Result = ControlFlow<Result<Certainty, NoSolution>>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a comment to this type explaining what the different values mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comment

@spirali spirali force-pushed the fix-FindParamInClause branch from 17ee9a9 to fab2e8e Compare March 7, 2026 20:13
@rust-log-analyzer

This comment has been minimized.

@spirali spirali force-pushed the fix-FindParamInClause branch from fab2e8e to 592246e Compare March 7, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FindParamInClause visitor can stack overflow

5 participants