-
Notifications
You must be signed in to change notification settings - Fork 13.8k
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-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`D-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.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.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
#![feature(generic_associated_types)]
// The cyclic dependency between trait A and B compiles as expected
trait A {
type BType: B<AType = Self>;
}
trait B {
type AType: A<BType = Self>;
}
// rustc crashes on the generic cyclic dependency between traits C and D
trait C {
type DType<T>: D<T, CType = Self>;
}
trait D<T> {
type CType: C<DType = Self>;
}
we currently emit
error[E0107]: missing generics for associated type `C::DType`
--> src/lib.rs:14:10
|
14 | type DType<T>: D<T, CType = Self>;
| ^^^^^ expected 1 type argument
|
note: associated type defined here, with 1 type parameter: `T`
--> src/lib.rs:14:10
|
14 | type DType<T>: D<T, CType = Self>;
| ^^^^^ -
help: use angle brackets to add missing type argument
|
14 | type DType<T><T>: D<T, CType = Self>;
| ^^^
where the correct suggestion would be
error[E0107]: missing generics for associated type `C::DType`
--> src/lib.rs:14:10
|
17 | type CType: C<DType = Self>;
| ^^^^^ expected 1 type argument
|
note: associated type defined here, with 1 type parameter: `T`
--> src/lib.rs:14:10
|
14 | type DType<T>: D<T, CType = Self>;
| ^^^^^ -
help: use angle brackets to add missing type argument
|
17 | type CType: C<DType<T> = Self>;
| ^^^
CC #81712
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-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`D-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.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.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.