Skip to content

Apply nested goals certainty to InspectGoals for normalizes-to #142127

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

compiler-errors
Copy link
Member

...so that normalizes-to goals don't have Certainty::Yes even if they have nested goals which don't hold.

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 Jun 6, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jun 6, 2025

Some changes occurred to the core trait solver

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

This PR changes a file inside tests/crashes. If a crash was fixed, please move into the corresponding ui subdir and add 'Fixes #' to the PR description to autoclose the issue upon merge.

@compiler-errors compiler-errors force-pushed the nested-goals-certainty branch from 9eb62ee to 19be2d3 Compare June 6, 2025 17:33
@@ -218,13 +220,39 @@ impl<'a, 'tcx> InspectCandidate<'a, 'tcx> {
// building their proof tree, the expected term was unconstrained, but when
// instantiating the candidate it is already constrained to the result of another
// candidate.
let proof_tree = infcx
.probe(|_| infcx.evaluate_root_goal_raw(goal, GenerateProofTree::Yes, None).1);
Copy link
Member Author

Choose a reason for hiding this comment

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

Here's the major change. Instead of evaluating the goal in this probe and throwing away nested obligations, then later constraining the RHS, we now evaluate the goal, constrain the RHS, and evaluate nested obligations all together, and stash the resulting certainty.

Then later on where we used to constrain the RHS in the InspectGoal::new constructor, we just apply that certainty.

@@ -1,14 +0,0 @@
//@ known-bug: #140571
Copy link
Member Author

Choose a reason for hiding this comment

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

This test was coincidentally fixed, but not for a particularly good reason. It's properly fixed in #142126.

@compiler-errors
Copy link
Member Author

@bors2 try @rust-timer queue

Even if perf is bad, we still definitely need to do this for proof trees not to be wrong.

@rust-timer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Jun 6, 2025

⌛ Trying commit 19be2d3 with merge 7cf36c7

To cancel the try build, run the command @bors2 try cancel.

rust-bors bot added a commit that referenced this pull request Jun 6, 2025
Apply nested goals certainty to `InspectGoals` for normalizes-to

...so that normalizes-to goals don't have `Certainty::Yes` even if they have nested goals which don't hold.

r? lcnr
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 6, 2025
@compiler-errors
Copy link
Member Author

Blocking this on #142085 so that I can remove the hack it introduces for normalizes-to goals.

@rust-bors
Copy link

rust-bors bot commented Jun 6, 2025

☀️ Try build successful (CI)
Build commit: 7cf36c7 (7cf36c7d59c354b06abb77c533b6a03fc4568472)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7cf36c7): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.2% [-0.2%, -0.2%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (secondary 0.8%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
5.0% [4.6%, 5.7%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.4% [-4.9%, -2.0%] 3
All ❌✅ (primary) - - 0

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 751.682s -> 751.844s (0.02%)
Artifact size: 371.84 MiB -> 371.90 MiB (0.02%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 6, 2025
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.

4 participants