I'm trying to compile following rust code:
#[derive(Clone)]
struct Foo<Data> {
f: fn(&Data),
}
trait Trait : Clone {
type DataType;
}
// throws:
// error[E0277]: the trait bound `Data: std::clone::Clone` is not satisfied
impl<Data> Trait for Foo<Data> {
type DataType = Data;
}
It complains about Data
generic argument not satisfying Clone
constraint, even though it is not supposed to.
From my understanding Foo<Data>
should support Clone
without need for Data
to support it.
What am I doing wrong?