-
Notifications
You must be signed in to change notification settings - Fork 14k
Show env normalization differences under two solvers #148939
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
base: main
Are you sure you want to change the base?
Conversation
|
Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
This comment has been minimized.
This comment has been minimized.
5cd4303 to
4408f14
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
| orig_pred, | ||
| ) { | ||
| Ok(pred_by_next) => { | ||
| if pred_by_next == *pred_by_old { |
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.
need to fully resolve the predicates before comparing them. This is causing the error in std. Also just generally move this further to the end of this function?
I think doing it here isn't ideally, but should be good enough for a crater run
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.
std compiles fine after resolving predicates normalized by the old solver.
It turns out that stderr changes of some tests are noise. They're restored to the original state.
This comment has been minimized.
This comment has been minimized.
|
@rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
| impl<'a, T> Check for T | ||
| //~^ ERROR: overflow evaluating the requirement `T: Check` | ||
| where | ||
| T: Iterate<'a>, |
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.
Should projection alias in param env imply that the trait predicate holds for the next solver?
I add manual trait clause for these three specialization tests to avoid unnecessary lint triggering.
|
If we resolve regions for the next solver, these two tests will trigger ICEs. They're the same tests mentioned in 166.
The cause is that we add constraints that contains placeholders to infcx's constraints collector and Now the only ui test broken should be the one in PR description. Sorry for not running all tests faithfully before. |
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.
The next solver normalizes free alias to opaque while the old solver doesn't.
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.
this is not a diverging between the trait solvers, but instead deeply normalizing with the new solver not checking whether predicates may get normalized.
see
rust/compiler/rustc_trait_selection/src/traits/normalize.rs
Lines 484 to 490 in 66bc5a4
| fn fold_predicate(&mut self, p: ty::Predicate<'tcx>) -> ty::Predicate<'tcx> { | |
| if p.allow_normalization() && needs_normalization(self.selcx.infcx, &p) { | |
| p.super_fold_with(self) | |
| } else { | |
| p | |
| } | |
| } |
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.
Should we add a try_fold_predicate with this check to the next solver version as well?
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.
yes
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.
The next solver normalizes projection alias to opaque while the old solver doesn't.
This comment has been minimized.
This comment has been minimized.
this should similarly affect the old solver except that it does not register outlives constraints if I feel like we can probably just disable that ICE/assert for now, idk where exactly that happens and didn't look into it before writing this comment |
yeah, the next solver doesn't seem to check
Got it. I'll ignore the errors of |
|
About ICE in this test. I understand that the Now that we accept we will run into generic const in normalization with the next solver, there're two choices:
|
571ea88 to
578bcc8
Compare
|
@rustbot ready |
|
@bors try |
This comment has been minimized.
This comment has been minimized.
Show env normalization differences under two solvers
|
@craterbot check |
|
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
First step for param_env normalization future compat warning. zulip thread
I didn't put the check directly in
param_envquery becausenormalize_param_env_or_errorhas some adjustments on the predicates: elaboration and outlive predicates manipulation. I'd have to replicate these inparam_envto compare normalized predicates properly.The downside of putting the check inside
normalize_param_env_or_erroris that it's used in more thanparam_envquery. It's also used incompare_impl_itemand several other places. I'm not sure if this is desired.I didn't bless tests since the hard error will be changed to lint later.Blessed tests to demonstrate the changes.
And there's one test about const generics I don't know how to fix.
Canonicalizer for the next solver will replace
ParamConstwithPlaceholderConst, but it still uses the sametry_evaluate_constinternally andprocess_obligationdoesn't likePlaceholderConst.r? @lcnr