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

Make RPITITs inherit the assumed_wf_types of their parent method #113704

Merged
merged 3 commits into from Jul 30, 2023

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Jul 14, 2023

... and then move the RPITIT well-formedness check to just use the regular logic of wfchecking an associated type.


We need to inherit the assumed_wf_types of the RPITIT's parent function in order for the given code to be considered well-formed:

trait Foo {
  fn bar<'a, T>(_: &'a T) -> impl Iterator<Output = &'a T>;
}

Since for &'a T to be WF, we need T: 'a.

In order for this to work for late-bound lifetimes, we need to do some additional mapping of any late-bound lifetimes captured by these assumed wf types. This is because within the body of the function (and thus in the assumed_wf_types), they're represented as ReFree variants of the original late-bound lifetimes declared in the function's generics, but in the RPITIT's GAT, they're represented as "reified" ReEarlyBound vars (duplicated during opaque type lowering). Luckily, the mapping between these two is already stored in the opaque.

Fixes #113796

@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 Jul 14, 2023
@bors
Copy link
Contributor

bors commented Jul 18, 2023

☔ The latest upstream changes (presumably #113801) made this pull request unmergeable. Please resolve the merge conflicts.

@rust-log-analyzer

This comment has been minimized.

@compiler-errors compiler-errors marked this pull request as ready for review July 27, 2023 18:18
@compiler-errors
Copy link
Member Author

r? @spastorino

@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@spastorino spastorino left a comment

Choose a reason for hiding this comment

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

This is great Michael, thanks for doing this.

r=me after checking my nits and doing what you prefer with them.

compiler/rustc_ty_utils/src/implied_bounds.rs Outdated Show resolved Hide resolved
compiler/rustc_ty_utils/src/implied_bounds.rs Outdated Show resolved Hide resolved
@spastorino
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jul 28, 2023

📌 Commit eb85ca976166c66c6ee1e9238b1a8b21b24332f6 has been approved by spastorino

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 Jul 28, 2023
@bors
Copy link
Contributor

bors commented Jul 29, 2023

⌛ Testing commit eb85ca976166c66c6ee1e9238b1a8b21b24332f6 with merge 9e7cc5cc95a272c11378af6cded2dcb7b5c2dee3...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Jul 29, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 29, 2023
@compiler-errors
Copy link
Member Author

had to bless a test

@bors r=spastorino

@bors
Copy link
Contributor

bors commented Jul 29, 2023

📌 Commit 744e770 has been approved by spastorino

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 Jul 29, 2023
@bors
Copy link
Contributor

bors commented Jul 29, 2023

⌛ Testing commit 744e770 with merge b969b83...

@bors
Copy link
Contributor

bors commented Jul 30, 2023

☀️ Test successful - checks-actions
Approved by: spastorino
Pushing b969b83 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 30, 2023
@bors bors merged commit b969b83 into rust-lang:master Jul 30, 2023
12 checks passed
@rustbot rustbot added this to the 1.73.0 milestone Jul 30, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (b969b83): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.2% [0.2%, 0.2%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.4% [1.9%, 2.9%] 2
Regressions ❌
(secondary)
1.6% [1.6%, 1.6%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.6% [-4.4%, -2.7%] 2
All ❌✅ (primary) 2.4% [1.9%, 2.9%] 2

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.9% [2.9%, 2.9%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 652.626s -> 650.727s (-0.29%)

@compiler-errors compiler-errors deleted the rpitit-assumed-wf-inherit branch August 11, 2023 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

AFIT no longer seems to play nice with lifetime GATs
6 participants