Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Znext-solver=coherence: suggest increasing recursion limit #121497

Merged

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Feb 23, 2024

@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 23, 2024
@rustbot
Copy link
Collaborator

rustbot commented Feb 23, 2024

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

@bors
Copy link
Contributor

bors commented Feb 24, 2024

☔ The latest upstream changes (presumably #121549) made this pull request unmergeable. Please resolve the merge conflicts.

@lcnr lcnr force-pushed the coherence-suggest-increasing-recursion-limit branch 2 times, most recently from 7b44eae to 8003148 Compare February 26, 2024 09:02
@bors
Copy link
Contributor

bors commented Feb 26, 2024

☔ The latest upstream changes (presumably #119106) made this pull request unmergeable. Please resolve the merge conflicts.

@lcnr lcnr force-pushed the coherence-suggest-increasing-recursion-limit branch from 8003148 to 327043d Compare February 26, 2024 16:55
@rust-log-analyzer

This comment has been minimized.

@lcnr lcnr force-pushed the coherence-suggest-increasing-recursion-limit branch from 327043d to eeba944 Compare February 27, 2024 07:47
fn impl_intersection_has_impossible_obligation<'a, 'cx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'tcx>,
obligations: &'a [PredicateObligation<'tcx>],
) -> Option<PredicateObligation<'tcx>> {
) -> Result<(), Vec<ty::Predicate<'tcx>>> {
Copy link
Member

@compiler-errors compiler-errors Feb 28, 2024

Choose a reason for hiding this comment

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

This logic is really confusing. Please turn this into an enum with proper states. Like, I cannot grasp the control flow between Err(vec![]) vs Err(vec![elements, inside]) for overflow vs Ok(()).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the controlflow for Err(vec![]) and Err(vec![elements, inside]) is identical 🤔 changed it to a newtype instead

(
MaybeCause::Overflow { suggest_increasing_limit: a },
MaybeCause::Overflow { suggest_increasing_limit: b },
) => MaybeCause::Overflow { suggest_increasing_limit: a || b },
Copy link
Member

Choose a reason for hiding this comment

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

We don't suggest increasing the limit if we hit a true cycle, correct? I feel like this should be &&, because increasing the limit here when one of the branches is false (i.e. cycle) will not have a positive effect.

Copy link
Member

Choose a reason for hiding this comment

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

Or hitting the fixpoint limit, which also won't be improved by increasing the limit.

Copy link
Contributor Author

@lcnr lcnr Feb 29, 2024

Choose a reason for hiding this comment

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

it will, in case one of the goals fails or has no constraints, if we have two nested goals:

  • non recursion_limit cycle
  • recursion_limit increase -> error

then we should suggest increasing the recursion limit as it would change the result to NoSolution which may then remove ambiguity elsewhere

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 28, 2024
@bors
Copy link
Contributor

bors commented Feb 28, 2024

☔ The latest upstream changes (presumably #121489) made this pull request unmergeable. Please resolve the merge conflicts.

@lcnr lcnr force-pushed the coherence-suggest-increasing-recursion-limit branch from eeba944 to 8c5e83d Compare February 29, 2024 09:28
@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Mar 1, 2024

📌 Commit 8c5e83d has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 1, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 2, 2024
…iaskrgr

Rollup of 11 pull requests

Successful merges:

 - rust-lang#111505 (Made `INVALID_DOC_ATTRIBUTES` lint deny by default)
 - rust-lang#120305 (Delete line if suggestion would replace it with an empty line)
 - rust-lang#121153 (Suggest removing superfluous semicolon when statements used as expression)
 - rust-lang#121497 (`-Znext-solver=coherence`: suggest increasing recursion limit)
 - rust-lang#121634 (Clarify behavior of slice prefix/suffix operations in case of equality)
 - rust-lang#121706 (match lowering: Remove hacky branch in sort_candidate)
 - rust-lang#121730 (Add profiling support to AIX)
 - rust-lang#121750 (match lowering: Separate the `bool` case from other integers in `TestKind`)
 - rust-lang#121803 (Never say "`Trait` is implemented for `{type error}`")
 - rust-lang#121811 (Move sanitizer ui tests to sanitizer directory)
 - rust-lang#121824 (Implement missing ABI structures in StableMIR)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 4d71fe7 into rust-lang:master Mar 2, 2024
11 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Mar 2, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 2, 2024
Rollup merge of rust-lang#121497 - lcnr:coherence-suggest-increasing-recursion-limit, r=compiler-errors

`-Znext-solver=coherence`: suggest increasing recursion limit

r? `@compiler-errors`
@lcnr lcnr deleted the coherence-suggest-increasing-recursion-limit branch March 4, 2024 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

6 participants