Skip to content

GAT: Constructing associated types parameterised by lifetime #67089

Closed
@dhardy

Description

@dhardy

Uses generic associated types - #44265

As I understand it, the following should be legal:

trait A {
    type B<'a>;
    
    fn make_b<'a>(&'a self) -> Self::B<'a>;
}

I simply get an error:

error[E0109]: lifetime arguments are not allowed for this type
 --> src/lib.rs:6:40
  |
6 |     fn make_b<'a>(&'a self) -> Self::B<'a>;
  |                                        ^^ lifetime argument not allowed

Playground: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=a4a05477f9f0f529277707801ffd0297

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-GATsArea: Generic associated types (GATs)A-associated-itemsArea: Associated items (types, constants & functions)C-bugCategory: This is a bug.F-generic_associated_types`#![feature(generic_associated_types)]` a.k.a. GATsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions