Given the following code: play
trait A {
type X;
}
trait B: A {
type X; // note: this is legal
}
impl<X> Clone for Box<dyn B<X=X, X=X>> {
fn clone(&self) -> Self {
todo!()
}
}
The current output is:
error[E0719]: the value of the associated type `X` (from trait `B`) is already specified
--> src/lib.rs:9:34
|
9 | impl<X> Clone for Box<dyn B<X=X, X=X>> {
| --- ^^^ re-bound here
| |
| `X` bound here first
error[E0191] the value of the associated type `X` (from trait `A`) must be specified
--> src/lib.rs:9:27
|
2 | type X;
| ------- `X` defined here
...
9 | impl<X> Clone for Box<dyn B<X=X, X=X>> {
| ^^^^^^^^^^^ help: specify the associated type: `B<X=X, X=X, X = Type>`
B<X=X, X=X, X = Type> is wrong, specifying another X=Type isn't going to fix the problem.
Writing just dyn B has a suggestion consider introducing a new type parameter, adding `where` constraints using the fully-qualified path to the associated types, which is good, but the concrete syntax would be nice.
Given the following code: play
The current output is:
B<X=X, X=X, X = Type>is wrong, specifying anotherX=Typeisn't going to fix the problem.Writing just
dyn Bhas a suggestionconsider introducing a new type parameter, adding `where` constraints using the fully-qualified path to the associated types, which is good, but the concrete syntax would be nice.