Compiling the following:
struct Foo {
foo: bool,
}
#[deriving(Clone)]
struct Bar {
foo: Foo,
}
fn main() {
let a = Bar { foo: Foo { foo: true }};
a.clone();
}
produces
clonespan.rs:5:11: 5:16 error: mismatched types: expected `Foo` but found `&Foo` (expected struct Foo but found &-ptr)
clonespan.rs:5 #[deriving(Clone)]
^~~~~
The real error is that Foo doesn't implement Clone. The span should also probably point to Foo in the definition for Bar instead of to the deriving line.
Compiling the following:
produces
The real error is that
Foodoesn't implementClone. The span should also probably point toFooin the definition forBarinstead of to the deriving line.