Description
Given the following code: Link to playground
fn main() {}
trait A {
fn a(aa: B) -> Result<_, B> {
Ok(())
}
}
enum B {}
The current output is:
Compiling s1 v0.1.0 (/Users/forest/Documents/test/s1)
error[E0391]: cycle detected when computing function signature of `A::a`
--> src/main.rs:3:5
|
3 | fn a(aa: B) -> Result<_, B> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: ...which requires type-checking `A::a`...
--> src/main.rs:3:5
|
3 | fn a(aa: B) -> Result<_, B> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires computing the variances of `B`...
--> src/main.rs:8:1
|
8 | enum B {}
| ^^^^^^
= note: ...which requires computing the variances for items in this crate...
= note: ...which again requires computing function signature of `A::a`, completing the cycle
note: cycle used when collecting item types in top-level module
--> src/main.rs:1:1
|
1 | fn main() {}
| ^^^^^^^^^
For more information about this error, try `rustc --explain E0391`.
error: could not compile `s1` due to previous error
I expected the compiler to let me know that function signature was wrong with the _
in Result<_, B>
. Once I changed this, it compiled fine.