-
Notifications
You must be signed in to change notification settings - Fork 13.9k
-Znext-solver instantiate predicate binder without recanonicalizing goal
#146725
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
Conversation
|
changes to Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
-Znext-solver instantiate predicate binder without recanonicalizing goal
This comment was marked as outdated.
This comment was marked as outdated.
|
@rfcbot fcp merge |
|
Team member @lcnr has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
|
@bors rollup=never |
| ty::PredicateKind::Ambiguous => { | ||
| self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS) | ||
| } | ||
| self.enter_forall(kind, |ecx, kind| match kind { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
much cleaner, nice :>
|
🔔 This is now entering its final comment period, as per the review above. 🔔 |
|
@bors try @rust-timer queeu |
This comment has been minimized.
This comment has been minimized.
`-Znext-solver` instantiate predicate binder without recanonicalizing goal
|
@rust-timer queue |
This comment has been minimized.
This comment has been minimized.
|
A job failed! Check out the build log: (web) (plain enhanced) (plain) Click to see the possible cause of the failure (guessed by this bot) |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (e5a41b8): comparison URL. Overall result: ❌✅ regressions and improvements - no action neededBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (secondary 3.9%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 4.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 473.415s -> 471.736s (-0.35%) |
|
r=me if CI passes |
|
@bors r=BoxyUwU |
|
☀️ Test successful - checks-actions |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 695857b (parent) -> 37ec98f (this PR) Test differencesShow 21 test diffsStage 1
Stage 2
Additionally, 15 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 37ec98f5d33c0876a9ffa5ee17dc0895659efe37 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (37ec98f): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -0.8%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 472.072s -> 472.516s (0.09%) |
This strengthens the leak check to match the old trait solver. The new trait solver now also instantiates higher ranked goals in the same scope as candidate selection, so the leak check in each candidate detects placeholder errors involving this higher ranked goal.
E.g. let's look at tests/ui/higher-ranked/leak-check/leak-check-in-selection-2.rs
Here proving
(): for<'a> Trait<&'a str, ?u>viaimpl<'a> Trait<&'a str, &'a str> for ()equates?uwith&'!a strwhich results in a leak check error as?ucannot name'a. If this leak check error happens while considering candidates we drop the first impl and infer?utoString. If not, this remains ambiguous.This behavior is a bit iffy, see the FCP proposal in #119820 for more details on why this current behavior is somewhat undesirable. However, considering placeholders from higher-ranked goals for candidate selection does allow more code to compile and a lot of the code feels like it should compile. This caused us to revert the change of #119820 in #127568.
I originally expected that we can avoid breakage with the new solver differently here, e.g. by considering OR-region constraints. However, doing so is a significant change and I don't have a great idea for how that should work. Matching the old solver behavior for now should not make this cleaner approach any more difficult in the future, so let's just go with what actually allows us to stabilize the new solver for now.
This PR changing the new solver to match the behavior of the old one wrt the leak check. As the new solver is already used by default in coherence, this allows more code to compile, see
tests/ui/higher-ranked/leak-check/leak-check-in-selection-7-coherence.rs:This behavior is quite arbitrary and not something I expect users to rely on in practice, however, it should still go through an FCP imo.
r? @BoxyUwU originally implemented by @compiler-errors in #136997. Closes rust-lang/trait-system-refactor-initiative#120.