Skip to content

Commit bf360dc

Browse files
committed
Add test of recursive trait aliases
1 parent cd0fc44 commit bf360dc

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#![feature(trait_alias)]
2+
3+
trait T1 = T2;
4+
//~^ ERROR cycle detected when computing the super predicates of `T1`
5+
6+
trait T2 = T3;
7+
8+
trait T3 = T1 + T3;
9+
10+
fn main() {}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
error[E0391]: cycle detected when computing the super predicates of `T1`
2+
--> $DIR/infinite-trait-alias-recursion.rs:3:1
3+
|
4+
LL | trait T1 = T2;
5+
| ^^^^^^^^^^^^^^
6+
|
7+
note: ...which requires computing the super traits of `T1`...
8+
--> $DIR/infinite-trait-alias-recursion.rs:3:12
9+
|
10+
LL | trait T1 = T2;
11+
| ^^
12+
note: ...which requires computing the super predicates of `T2`...
13+
--> $DIR/infinite-trait-alias-recursion.rs:6:1
14+
|
15+
LL | trait T2 = T3;
16+
| ^^^^^^^^^^^^^^
17+
note: ...which requires computing the super traits of `T2`...
18+
--> $DIR/infinite-trait-alias-recursion.rs:6:12
19+
|
20+
LL | trait T2 = T3;
21+
| ^^
22+
note: ...which requires computing the super predicates of `T3`...
23+
--> $DIR/infinite-trait-alias-recursion.rs:8:1
24+
|
25+
LL | trait T3 = T1 + T3;
26+
| ^^^^^^^^^^^^^^^^^^^
27+
note: ...which requires computing the super traits of `T3`...
28+
--> $DIR/infinite-trait-alias-recursion.rs:8:12
29+
|
30+
LL | trait T3 = T1 + T3;
31+
| ^^
32+
= note: ...which again requires computing the super predicates of `T1`, completing the cycle
33+
note: cycle used when collecting item types in top-level module
34+
--> $DIR/infinite-trait-alias-recursion.rs:3:1
35+
|
36+
LL | trait T1 = T2;
37+
| ^^^^^^^^^^^^^^
38+
39+
error: aborting due to previous error
40+
41+
For more information about this error, try `rustc --explain E0391`.

0 commit comments

Comments
 (0)