-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-trait-systemArea: Trait systemArea: Trait systemD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.F-associated_type_bounds`#![feature(associated_type_bounds)]``#![feature(associated_type_bounds)]`I-cycleIssue: A query cycle occurred while none was expectedIssue: A query cycle occurred while none was expectedT-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
I don't know if this is a bug or expected behaviour. But I'm encountering the following error when compiling the following code.
#![feature(associated_type_bounds)]
trait A {
type T;
}
trait B: A<T: B> {}
error[E0391]: cycle detected when computing the supertraits of `B`
--> src/main.rs:6:15
|
6 | trait B: A<T: B> {}
| ^
|
= note: ...which again requires computing the supertraits of `B`, completing the cycle
note: cycle used when collecting item types in top-level module
--> src/main.rs:6:1
|
6 | trait B: A<T: B> {}
| ^^^^^^^^^^^^^^^^
But if I merge the traits A
and B
into the trait C
it works.
trait C {
type T: C;
}
I think the first example should work as good as the second since the trait C
is only split into two traits A
and B
with same functionality.
tower120, Jeff-A-Martin and MikaelMayer
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-trait-systemArea: Trait systemArea: Trait systemD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.F-associated_type_bounds`#![feature(associated_type_bounds)]``#![feature(associated_type_bounds)]`I-cycleIssue: A query cycle occurred while none was expectedIssue: A query cycle occurred while none was expectedT-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.