Test that functional struct update exprs get rejected if...
...they require copying noncopyable fields.
This commit is contained in:
parent
71dbbe145c
commit
632d60691a
16
src/test/compile-fail/functional-struct-update.rs
Normal file
16
src/test/compile-fail/functional-struct-update.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
struct Bar {
|
||||
x: int,
|
||||
drop { io::println("Goodbye, cruel world"); }
|
||||
}
|
||||
|
||||
struct Foo {
|
||||
x: int,
|
||||
y: Bar
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let a = Foo { x: 1, y: Bar { x: 5 } };
|
||||
let c = Foo { x: 4, .. a}; //~ ERROR copying a noncopyable value
|
||||
io::println(fmt!("%?", c));
|
||||
}
|
||||
|
Loading…
Reference in a new issue