2013-09-19 19:59:06 -05:00
|
|
|
// Issue 4691: Ensure that functional-struct-update can only copy, not
|
|
|
|
// move, when the struct implements Drop.
|
|
|
|
|
2015-08-11 19:27:05 -05:00
|
|
|
struct B;
|
|
|
|
struct S { a: isize, b: B }
|
2013-09-19 19:59:06 -05:00
|
|
|
impl Drop for S { fn drop(&mut self) { } }
|
|
|
|
|
2015-01-08 04:54:35 -06:00
|
|
|
struct T { a: isize, mv: Box<isize> }
|
2013-09-19 19:59:06 -05:00
|
|
|
impl Drop for T { fn drop(&mut self) { } }
|
|
|
|
|
|
|
|
fn f(s0:S) {
|
2016-05-16 17:40:27 -05:00
|
|
|
let _s2 = S{a: 2, ..s0};
|
2019-04-22 02:40:08 -05:00
|
|
|
//~^ ERROR [E0509]
|
2013-09-19 19:59:06 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn g(s0:T) {
|
2016-05-16 17:40:27 -05:00
|
|
|
let _s2 = T{a: 2, ..s0};
|
2019-04-22 02:40:08 -05:00
|
|
|
//~^ ERROR [E0509]
|
2013-09-19 19:59:06 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() { }
|