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