Description
On a nightly rustup 1.18.3 (435397f48 2019-05-22)
Some code like this
#![feature(existential_type)]
pub trait T {
fn bla() -> ();
}
pub struct S {
v: u64
}
impl T for S {
fn bla() -> () {}
}
existential type TE: T;
pub fn bla() -> TE {
return S {v:1}
}
pub fn bla2() -> TE {
bla()
}
cause error
Compiling playground v0.0.1 (/playground)
error[E0391]: cycle detected when processingTE
--> src/lib.rs:14:1
|
14 | existential type TE: T;
| ^^^^^^^^^^^^^^^^^^^^^^^
|
note: ...which requires processingbla2
...
--> src/lib.rs:19:21
|
19 | pub fn bla2() -> TE {
| ___________________^
20 | | bla()
21 | | }
| |^
= note: ...which again requires processingTE
, completing the cycle
note: cycle used when collecting item types in top-level module
--> src/lib.rs:1:1
|
1 | / #![feature(existential_type)]
2 | | pub trait T {
3 | | fn bla() -> ();
4 | | }
... |
20 | | bla()
21 | | }
| |^error: concrete type differs from previous defining existential type use
--> src/lib.rs:19:1
|
19 | / pub fn bla2() -> TE {
20 | | bla()
21 | | }
| |^ expectedS
, gotTE
|
note: previous use here
--> src/lib.rs:15:1
|
15 | / pub fn bla() -> TE {
16 | | return S {v:1}
17 | | }
| |^error: aborting due to 2 previous errors
playground link:
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=71c724f92b074d0b6f355a6aaf8d3d1a