Skip to content

RPITIT with GAT fails to enforce where Self: 'a bound #116789

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
aliemjay opened this issue Oct 16, 2023 · 0 comments · Fixed by #116800
Closed

RPITIT with GAT fails to enforce where Self: 'a bound #116789

aliemjay opened this issue Oct 16, 2023 · 0 comments · Fixed by #116800
Assignees
Labels
C-bug Category: This is a bug. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-types Relevant to the types team, which will review and decide on the PR/issue.

Comments

@aliemjay
Copy link
Member

The following compiles after the stabilization of RPITIT/AFIT in #115822:

trait Trait {
    type Gat<'a>;
    async fn foo(&self) -> Self::Gat<'_>;
}

but it should require adding where Self: 'a bound to Gat similar to the non-async version (see #87479):

trait Trait {
    type Gat<'a>;
    //~^ ERROR missing required bound on `Gat`
    //~| HELP add the required where clause: `where Self: 'a`

    fn foo(&self) -> Self::Gat<'_>;
}

cc @compiler-errors

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 16, 2023
@aliemjay aliemjay added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. T-types Relevant to the types team, which will review and decide on the PR/issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Oct 16, 2023
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Oct 16, 2023
@compiler-errors compiler-errors self-assigned this Oct 16, 2023
@bors bors closed this as completed in d0ade3f Oct 17, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Oct 17, 2023
Rollup merge of rust-lang#116800 - compiler-errors:rpitit-gat-outlives, r=jackh726

Fix implied outlives check for GAT in RPITIT

We enforce certain `Self: 'lt` bounds for GATs to save space for more sophisticated implied bounds, but those currently operate on the HIR. Code was easily reworked to operate on def-ids so that we can properly let these suggestions propagate through synthetic associated types like RPITITs and AFITs.

r? `@jackh726` or `@aliemjay`

Fixes rust-lang#116789
@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Oct 17, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: This is a bug. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-types Relevant to the types team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants