Skip to content

Commit 2368aa8

Browse files
committed
Add some tests
1 parent 33b3b13 commit 2368aa8

4 files changed

+88
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#![feature(existential_type)]
2+
3+
existential type Foo: Fn() -> Foo;
4+
//~^ ERROR: cycle detected when processing `Foo`
5+
6+
fn crash(x: Foo) -> Foo {
7+
x
8+
}
9+
10+
fn main() {
11+
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
error[E0391]: cycle detected when processing `Foo`
2+
--> $DIR/existential-types-with-cycle-error.rs:3:1
3+
|
4+
LL | existential type Foo: Fn() -> Foo;
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
note: ...which requires processing `crash`...
8+
--> $DIR/existential-types-with-cycle-error.rs:6:25
9+
|
10+
LL | fn crash(x: Foo) -> Foo {
11+
| _________________________^
12+
LL | | x
13+
LL | | }
14+
| |_^
15+
= note: ...which again requires processing `Foo`, completing the cycle
16+
note: cycle used when collecting item types in top-level module
17+
--> $DIR/existential-types-with-cycle-error.rs:1:1
18+
|
19+
LL | / #![feature(existential_type)]
20+
LL | |
21+
LL | | existential type Foo: Fn() -> Foo;
22+
LL | |
23+
... |
24+
LL | |
25+
LL | | }
26+
| |_^
27+
28+
error: aborting due to previous error
29+
30+
For more information about this error, try `rustc --explain E0391`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#![feature(existential_type)]
2+
3+
pub trait Bar<T> {
4+
type Item;
5+
}
6+
7+
existential type Foo: Bar<Foo, Item = Foo>;
8+
//~^ ERROR: cycle detected when processing `Foo`
9+
10+
fn crash(x: Foo) -> Foo {
11+
x
12+
}
13+
14+
fn main() {
15+
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
error[E0391]: cycle detected when processing `Foo`
2+
--> $DIR/existential-types-with-cycle-error2.rs:7:1
3+
|
4+
LL | existential type Foo: Bar<Foo, Item = Foo>;
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
note: ...which requires processing `crash`...
8+
--> $DIR/existential-types-with-cycle-error2.rs:10:25
9+
|
10+
LL | fn crash(x: Foo) -> Foo {
11+
| _________________________^
12+
LL | | x
13+
LL | | }
14+
| |_^
15+
= note: ...which again requires processing `Foo`, completing the cycle
16+
note: cycle used when collecting item types in top-level module
17+
--> $DIR/existential-types-with-cycle-error2.rs:1:1
18+
|
19+
LL | / #![feature(existential_type)]
20+
LL | |
21+
LL | | pub trait Bar<T> {
22+
LL | | type Item;
23+
... |
24+
LL | |
25+
LL | | }
26+
| |_^
27+
28+
error: aborting due to previous error
29+
30+
For more information about this error, try `rustc --explain E0391`.

0 commit comments

Comments
 (0)