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

Don't repeatedly duplicate TAIT lifetimes for each subsequently nested TAIT #124106

Merged
merged 1 commit into from
Apr 19, 2024

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Apr 18, 2024

Make it so that nested TAITs inherit the lifetimes from their parent item, not their parent TAIT. This is because we don't need to re-duplicate lifetimes for nested TAITs over and over, since the only lifetimes they can capture are from the parent item anyways.

This mirrors how RPITs work. This is not a functional change that should be observable, since the whole point of duplicating lifetimes and marking the shadowed ones (and uncaptured ones) as bivariant is designed to not be observable.

r? oli-obk

@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 18, 2024
LL | | >
| |_____________^

error: [*, o]
Copy link
Member Author

Choose a reason for hiding this comment

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

Previously this would have been [*, *, *, *, *, o]

@rust-log-analyzer

This comment has been minimized.

@oli-obk
Copy link
Contributor

oli-obk commented Apr 19, 2024

since the only lifetimes they can capture are from the parent item anyways.

won't this change once binders on impl Trait actually become useful?

@compiler-errors
Copy link
Member Author

compiler-errors commented Apr 19, 2024

since the only lifetimes they can capture are from the parent item anyways.

won't this change once binders on impl Trait actually become useful?

Sorry, I guess I should have been more precise here.

The unsubstituted bounds of a child opaque never mention the duplicated lifetimes from the parent opaque. They can only mention the lifetimes that they capture (and thus duplicate into their own early-bound regions -- including from binders they're enclosed in, even though we don't support that).

So opaques in binders should definitely still work.

@oli-obk
Copy link
Contributor

oli-obk commented Apr 19, 2024

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Apr 19, 2024

📌 Commit ffb4206 has been approved by oli-obk

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 19, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 19, 2024
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#123571 (Correctly change type when adding adjustments on top of `NeverToAny`)
 - rust-lang#123729 (run-make: refactor out command wrappers for `clang` and `llvm-readobj`)
 - rust-lang#124106 (Don't repeatedly duplicate TAIT lifetimes for each subsequently nested TAIT)
 - rust-lang#124149 (rustdoc-search: fix description on aliases in results)
 - rust-lang#124155 (bootstrap: don't use rayon for sysinfo)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 26d4b1b into rust-lang:master Apr 19, 2024
12 checks passed
@rustbot rustbot added this to the 1.79.0 milestone Apr 19, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 19, 2024
Rollup merge of rust-lang#124106 - compiler-errors:tait-lifetime-dedup, r=oli-obk

Don't repeatedly duplicate TAIT lifetimes for each subsequently nested TAIT

Make it so that nested TAITs inherit the lifetimes from their parent item, not their parent TAIT. This is because we don't need to re-duplicate lifetimes for nested TAITs over and over, since the only lifetimes they can capture are from the parent item anyways.

This mirrors how RPITs work. This is **not** a functional change that should be observable, since the whole point of duplicating lifetimes and marking the shadowed ones (and uncaptured ones) as bivariant is designed to *not* be observable.

r? oli-obk
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.

5 participants