Skip to content

Wrong where Self: 'a GAT bound suggested #90816

Open

Description

Relates to #89970 and potentially to #90808.

#![feature(generic_associated_types)]

trait MyTrait {
    type AT<'a> where Self: 'a;
    
    fn selfreffing<'a>(&'a self) -> Self::AT<'a> { unimplemented!(); }
}

struct Inner;
impl MyTrait for Inner {
    type AT<'b> where Self: 'b = ();
}

struct Outer<'a, T>(&'a T);
impl<'a, T: MyTrait> MyTrait for Outer<'a, T> {
    type AT<'b> = T::AT<'b>;
    // type AT<'b> where T: 'b = T::AT<'b>; // suggested
    // type AT<'b> where Self: 'b = T::AT<'b>; // compiles
}

Playground

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-GATsArea: Generic associated types (GATs)A-diagnosticsArea: Messages for errors, warnings, and lintsGATs-triagedIssues using the `generic_associated_types` feature that have been triagedT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions