Auto merge of #79209 - spastorino:trait-inheritance-self, r=nikomatsakis
Allow Trait inheritance with cycles on associated types Fixes #35237 r? `@nikomatsakis` cc `@estebank`
This commit is contained in:
commit
349b3b324d
28 changed files with 499 additions and 152 deletions
|
|
@ -1,15 +1,25 @@
|
|||
error[E0391]: cycle detected when computing the supertraits of `T1`
|
||||
error[E0391]: cycle detected when computing the super predicates of `T1`
|
||||
--> $DIR/issue-12511.rs:1:1
|
||||
|
|
||||
LL | trait T1 : T2 {
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
note: ...which requires computing the super traits of `T1`...
|
||||
--> $DIR/issue-12511.rs:1:12
|
||||
|
|
||||
LL | trait T1 : T2 {
|
||||
| ^^
|
||||
note: ...which requires computing the super predicates of `T2`...
|
||||
--> $DIR/issue-12511.rs:5:1
|
||||
|
|
||||
note: ...which requires computing the supertraits of `T2`...
|
||||
LL | trait T2 : T1 {
|
||||
| ^^^^^^^^^^^^^
|
||||
note: ...which requires computing the super traits of `T2`...
|
||||
--> $DIR/issue-12511.rs:5:12
|
||||
|
|
||||
LL | trait T2 : T1 {
|
||||
| ^^
|
||||
= note: ...which again requires computing the supertraits of `T1`, completing the cycle
|
||||
= note: ...which again requires computing the super predicates of `T1`, completing the cycle
|
||||
note: cycle used when collecting item types in top-level module
|
||||
--> $DIR/issue-12511.rs:1:1
|
||||
|
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error[E0391]: cycle detected when computing the supertraits of `T`
|
||||
error[E0391]: cycle detected when computing the super traits of `T` with associated type name `Item`
|
||||
--> $DIR/issue-20772.rs:1:1
|
||||
|
|
||||
LL | / trait T : Iterator<Item=Self::Item>
|
||||
|
|
@ -6,8 +6,8 @@ LL | |
|
|||
LL | | {}
|
||||
| |__^
|
||||
|
|
||||
= note: ...which again requires computing the supertraits of `T`, completing the cycle
|
||||
note: cycle used when collecting item types in top-level module
|
||||
= note: ...which again requires computing the super traits of `T` with associated type name `Item`, completing the cycle
|
||||
note: cycle used when computing the super traits of `T`
|
||||
--> $DIR/issue-20772.rs:1:1
|
||||
|
|
||||
LL | / trait T : Iterator<Item=Self::Item>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
error[E0391]: cycle detected when computing the supertraits of `Processor`
|
||||
error[E0391]: cycle detected when computing the super traits of `Processor` with associated type name `Input`
|
||||
--> $DIR/issue-20825.rs:5:1
|
||||
|
|
||||
LL | pub trait Processor: Subscriber<Input = Self::Input> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: ...which again requires computing the supertraits of `Processor`, completing the cycle
|
||||
note: cycle used when collecting item types in top-level module
|
||||
= note: ...which again requires computing the super traits of `Processor` with associated type name `Input`, completing the cycle
|
||||
note: cycle used when computing the super traits of `Processor`
|
||||
--> $DIR/issue-20825.rs:5:1
|
||||
|
|
||||
LL | pub trait Processor: Subscriber<Input = Self::Input> {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
trait Expr : PartialEq<Self::Item> {
|
||||
//~^ ERROR: cycle detected
|
||||
// check-pass
|
||||
|
||||
trait Expr: PartialEq<Self::Item> {
|
||||
type Item;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
error[E0391]: cycle detected when computing the supertraits of `Expr`
|
||||
--> $DIR/issue-22673.rs:1:1
|
||||
|
|
||||
LL | trait Expr : PartialEq<Self::Item> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: ...which again requires computing the supertraits of `Expr`, completing the cycle
|
||||
note: cycle used when collecting item types in top-level module
|
||||
--> $DIR/issue-22673.rs:1:1
|
||||
|
|
||||
LL | trait Expr : PartialEq<Self::Item> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0391`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue