// Issue 4691: Ensure that functional-struct-update can only copy, not // move, when the struct implements Drop. struct B; struct S { a: isize, b: B, c: K } impl Drop for S { fn drop(&mut self) { } } struct T { a: isize, b: Box } impl Drop for T { fn drop(&mut self) { } } struct V { a: isize, b: Box, c: K } impl Drop for V { fn drop(&mut self) { } } #[derive(Clone)] struct Clonable; mod not_all_clone { use super::*; fn a(s0: S<()>) { let _s2 = S { a: 2, ..s0 }; //~^ ERROR [E0509] } fn b(s0: S) { let _s2 = S { a: 2, ..s0 }; //~^ ERROR [E0509] //~| ERROR [E0509] } fn c(s0: S) { let _s2 = S { a: 2, ..s0 }; //~^ ERROR [E0509] //~| ERROR [E0509] } } mod all_clone { use super::*; fn a(s0: T) { let _s2 = T { a: 2, ..s0 }; //~^ ERROR [E0509] } fn b(s0: T) { let _s2 = T { ..s0 }; //~^ ERROR [E0509] } fn c(s0: T) { let _s2 = T { a: 2, b: s0.b }; //~^ ERROR [E0509] } fn d(s0: V) { let _s2 = V { a: 2, ..s0 }; //~^ ERROR [E0509] //~| ERROR [E0509] } fn e(s0: V) { let _s2 = V { a: 2, ..s0 }; //~^ ERROR [E0509] //~| ERROR [E0509] } } fn main() { }