Open
Description
pub trait Constant: From<Self::Value> + Into<Self::Value> + Copy + Eq + Ord {
type Value;
}
Errors:
Compiling playground v0.0.1 (/playground)
error[E0391]: cycle detected when computing the supertraits of `Constant`
--> src/lib.rs:1:1
|
1 | pub trait Constant: From<Self::Value> + Into<Self::Value> + Copy + Eq + Ord {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: ...which again requires computing the supertraits of `Constant`, completing the cycle
note: cycle used when collecting item types in top-level module
--> src/lib.rs:1:1
|
1 | pub trait Constant: From<Self::Value> + Into<Self::Value> + Copy + Eq + Ord {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0391`.
error: could not compile `playground`
To learn more, run the command again with --verbose.
Note: it's possible to reproduce the issue with a lot simpler repro, leaving just the From<Self::Value
part, but example with more traits is more problematic, because in that case it's unclear which one of the trait clauses is actually causing the issue.
Note 2: Aside from improving diagnostics, why is this an error at all? There is no trait cycle as far as I can tell, it's just trying to use its own associated type which feels like should be fine...
cc @estebank