Opportunistically resolve region var in canonicalizer (instead of resolving root var) #118964
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See comment in
compiler/rustc_type_ir/src/infcx.rs
.The root infer region for a given region vid may not actually be nameable from the universe of the original vid. That means that the assertion in the canonicalizer was too strict, since the
EagerResolver
that we use before canonicalizing is doing only as much resolving as it can.This replaces
resolve_lt_var
andprobe_lt_var
in therustc_type_ir
API withopportunistic_resolve_lt_var
, which acts as you expect it should. I left a FIXME that complains about the inconsistency.This test is really gnarly, but I have no idea how to minimize it, since it seems to kind of just be coincidental that it triggered this issue. I hope the underlying root cause is easy enough to understand, though.
r? @lcnr or @aliemjay
Fixes #118950