]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrowck-struct-update-with-dtor.rs
Rollup merge of #106644 - alexcrichton:update-wasi-toolchain, r=cuviper
[rust.git] / tests / ui / borrowck / borrowck-struct-update-with-dtor.rs
1 // Issue 4691: Ensure that functional-struct-update can only copy, not
2 // move, when the struct implements Drop.
3
4 struct B;
5 struct S { a: isize, b: B }
6 impl Drop for S { fn drop(&mut self) { } }
7
8 struct T { a: isize, mv: Box<isize> }
9 impl Drop for T { fn drop(&mut self) { } }
10
11 fn f(s0:S) {
12     let _s2 = S{a: 2, ..s0};
13     //~^ ERROR [E0509]
14 }
15
16 fn g(s0:T) {
17     let _s2 = T{a: 2, ..s0};
18     //~^ ERROR [E0509]
19 }
20
21 fn main() { }