Skip to content

Commit 632d606

Browse files
committed
Test that functional struct update exprs get rejected if...
...they require copying noncopyable fields.
1 parent 71dbbe1 commit 632d606

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
struct Bar {
2+
x: int,
3+
drop { io::println("Goodbye, cruel world"); }
4+
}
5+
6+
struct Foo {
7+
x: int,
8+
y: Bar
9+
}
10+
11+
fn main() {
12+
let a = Foo { x: 1, y: Bar { x: 5 } };
13+
let c = Foo { x: 4, .. a}; //~ ERROR copying a noncopyable value
14+
io::println(fmt!("%?", c));
15+
}
16+

0 commit comments

Comments
 (0)