-
Notifications
You must be signed in to change notification settings - Fork 13.3k
New solver: assert that normalizes-to hack RHS is always constrained after eval #109583
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
New solver: assert that normalizes-to hack RHS is always constrained after eval #109583
Conversation
Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
// However it is important not to unconditionally replace the rhs with a new infer var | ||
// as otherwise we may replace the original unconstrained infer var with a new infer var | ||
// and never propagate any constraints on the new var back to the original var. |
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.
I'm not sure if this ever matters in practice?
Or to put it in another perspective, if this indeed does matter, I don't understand why it's then valid to replace a constrained RHS with a fresh var here without later equating that constrained RHS against that var.
}); | ||
|
||
// NOTE: This term should never be considered unconstrained, not least due to the fact | ||
// that the universe index has been bumped up at least once by `evaluate_goal` above. |
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.
why does evaluate_goal
bump the universe index/alternatively is term_is_fully_unconstrained
too pessimistic?
this is worrying to me.
I guess maybe we should change that code to replace the rhs with a new infer var, call evaluate_goal
for the normalizes_to hack and then emit add an eq goal for the inference vars or sth? that feels safer to me 🤔
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.
I guess maybe we should change that code to replace the rhs with a new infer var, call evaluate_goal for the normalizes_to hack and then emit add an eq goal for the inference vars or sth? that feels safer to me
yeah i can do that, i have a branch that does that and coincidentally the code actually gets a bit cleaner too...
@rustbot author |
…-2, r=lcnr,BoxyUwU Freshen normalizes-to hack goal RHS in the evaluate loop Ensure that we repeatedly equate the unconstrained RHS of the normalizes-to hack goal with the *actual* RHS of the goal, even if the normalizes-to goal loops several times and thus we replace the unconstrained RHS var repeatedly. Alternative to rust-lang#109583.
…-2, r=lcnr,BoxyUwU Freshen normalizes-to hack goal RHS in the evaluate loop Ensure that we repeatedly equate the unconstrained RHS of the normalizes-to hack goal with the *actual* RHS of the goal, even if the normalizes-to goal loops several times and thus we replace the unconstrained RHS var repeatedly. Alternative to rust-lang#109583.
See
NOTE
below, thethen_some
branch should never occur in practice.r? @BoxyUwU