Skip to content
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

Opportunistically resolve region var in canonicalizer (instead of resolving root var) #118964

Merged
merged 1 commit into from
Dec 15, 2023

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Dec 15, 2023

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 and probe_lt_var in the rustc_type_ir API with opportunistic_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

@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. labels Dec 15, 2023
@aliemjay aliemjay self-assigned this Dec 15, 2023
@aliemjay
Copy link
Member

r? aliemjay
@bors r+ rollup

@bors
Copy link
Contributor

bors commented Dec 15, 2023

📌 Commit 146e345 has been approved by aliemjay

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 15, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 15, 2023
Rollup of 2 pull requests

Successful merges:

 - rust-lang#118927 (Erase late bound regions from `Instance::fn_sig()` and add a few more details to StableMIR APIs)
 - rust-lang#118964 (Opportunistically resolve region var in canonicalizer (instead of resolving root var))

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 9a07292 into rust-lang:master Dec 15, 2023
11 checks passed
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 15, 2023
Rollup merge of rust-lang#118964 - compiler-errors:resolve, r=aliemjay

Opportunistically resolve region var in canonicalizer (instead of resolving root var)

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` and `probe_lt_var` in the `rustc_type_ir` API with `opportunistic_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 rust-lang#118950
@rustbot rustbot added this to the 1.76.0 milestone Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE: region vid should have been resolved fully before canonicalization
5 participants