-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-GATsArea: Generic associated types (GATs)Area: Generic associated types (GATs)A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)C-bugCategory: This is a bug.Category: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.F-generic_associated_types`#![feature(generic_associated_types)]` a.k.a. GATs`#![feature(generic_associated_types)]` a.k.a. GATsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
#![feature(generic_associated_types)]
trait Foo {
type Assoc<'a, const N: usize>;
}
fn foo<T: Foo>() {
let _: <T as Foo>::Assoc<3>;
}
results in the following error:
error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
--> src/lib.rs:7:24
|
7 | let _: <T as Foo>::Assoc<3>;
| ^^^^^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
--> src/lib.rs:3:10
|
3 | type Assoc<'a, const N: usize>;
| ^^^^^ --
help: add missing lifetime argument
|
7 | let _: <T as Foo>::Assoc<'a3>;
| ^^
Note that we suggest <T as Foo>::Assoc<'a3>
here, which is missing a comma.
Metadata
Metadata
Assignees
Labels
A-GATsArea: Generic associated types (GATs)Area: Generic associated types (GATs)A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)C-bugCategory: This is a bug.Category: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.F-generic_associated_types`#![feature(generic_associated_types)]` a.k.a. GATs`#![feature(generic_associated_types)]` a.k.a. GATsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.