Skip to content

Remap impl-trait lifetimes on HIR instead of AST lowering#129383

Merged
bors merged 6 commits intorust-lang:masterfrom
cjgillot:opaque-noremap
Oct 31, 2024
Merged

Remap impl-trait lifetimes on HIR instead of AST lowering#129383
bors merged 6 commits intorust-lang:masterfrom
cjgillot:opaque-noremap

Conversation

@cjgillot
Copy link
Contributor

@cjgillot cjgillot commented Aug 22, 2024

Current AST->HIR lowering goes out of its way to remap lifetimes for opaque types. This is complicated and leaks into upstream and downstream code.

This PR stops trying to be clever during lowering, and prefers to do this remapping during the HIR->ty lowering. The remapping computation easily fits into the bound var resolution code. Its result can be used in by generics_of and hir_ty_lowering::new_opaque to add the proper parameters and arguments.

See an example on the doc for query opaque_captured_lifetimes.

Based on #129244

Fixes #125249
Fixes #126850

cc @compiler-errors @spastorino
r? @petrochenkov

Loading
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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ICE: no def-id for fresh lifetime ICE: assertion failed: unique

6 participants