Closed
Description
struct NonCopyable {
x: (),
f: NonCopyable2
}
struct NonCopyable2 {
g: ()
}
impl NonCopyable2: Drop {
fn finalize(&self) { }
}
fn main() {
let a = NonCopyable { x: (), f: NonCopyable2 { g: () } };
let b = NonCopyable {
x: (),
.. a
};
}
/home/brian/dev/rust/src/test/run-pass/test.rs:16:8: 16:11 warning: unused variable: `b`
/home/brian/dev/rust/src/test/run-pass/test.rs:16 let b = NonCopyable {
^~~
/home/brian/dev/rust/src/test/run-pass/test.rs:16:12: 16:23 error: copying a noncopyable value
/home/brian/dev/rust/src/test/run-pass/test.rs:16 let b = NonCopyable {
^~~~~~~~~~~
error: aborting due to previous error
One of the fields in a
is noncopyable and doesn't get moved into b
. I think this should work as written, but if not then the error message should be better.