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

Erase lifetimes above ty::INNERMOST when probing ambiguous types #110195

Merged
merged 1 commit into from
Apr 13, 2023

Conversation

compiler-errors
Copy link
Member

Turns out that TyCtxt::replace_escaping_bound_vars_uncached only erases bound vars exactly at ty::INNERMOST, and not everything above. This regresses the suggestions for non-lifetime binders, but oh well, I don't really care about those.

Fixes #110052

@rustbot
Copy link
Collaborator

rustbot commented Apr 11, 2023

r? @lcnr

(rustbot has picked a reviewer for you, use r? to override)

@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 Apr 11, 2023
@aliemjay
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Apr 13, 2023

📌 Commit 5eb0528 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 Apr 13, 2023
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 13, 2023
…iemjay

Erase lifetimes above `ty::INNERMOST` when probing ambiguous types

Turns out that `TyCtxt::replace_escaping_bound_vars_uncached` only erases bound vars exactly at `ty::INNERMOST`, and not everything above. This regresses the suggestions for non-lifetime binders, but oh well, I don't really care about those.

Fixes rust-lang#110052
// I guess we don't need to make a universe unless we need it,
// but also we're on the error path, so it doesn't matter here.
let universe = infcx.create_next_universe();
let value = tcx.fold_regions(qself_ty, |_, _| tcx.lifetimes.re_erased);
Copy link
Contributor

Choose a reason for hiding this comment

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

sidenote, we should rename this function to fold_free_regions, or even map_free_regions. Because currently it feels unclear whether this is supposed to modify bound regions

Copy link
Member Author

Choose a reason for hiding this comment

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

"free" here is ambiguous because it also folds escaping bound vars, but yeah, I do think it needs a better name.

@lcnr
Copy link
Contributor

lcnr commented Apr 13, 2023

r? @aliemjay

@bors rollup

@rustbot rustbot assigned aliemjay and unassigned lcnr Apr 13, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Apr 13, 2023
…iemjay

Erase lifetimes above `ty::INNERMOST` when probing ambiguous types

Turns out that `TyCtxt::replace_escaping_bound_vars_uncached` only erases bound vars exactly at `ty::INNERMOST`, and not everything above. This regresses the suggestions for non-lifetime binders, but oh well, I don't really care about those.

Fixes rust-lang#110052
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 13, 2023
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#110072 (Stabilize IsTerminal)
 - rust-lang#110195 (Erase lifetimes above `ty::INNERMOST` when probing ambiguous types)
 - rust-lang#110218 (Remove `ToRegionVid`)
 - rust-lang#110220 (cleanup our region error API)
 - rust-lang#110234 (Fix btree `CursorMut::insert_after` check)
 - rust-lang#110262 (Update unwind_safe.rs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 958413c into rust-lang:master Apr 13, 2023
@rustbot rustbot added this to the 1.70.0 milestone Apr 13, 2023
@compiler-errors compiler-errors deleted the issue-110052 branch August 11, 2023 20:05
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: cannot relate bound region: '_#56r <= ReLateBound(DebruijnIndex(1), BoundRegion { ... }
5 participants