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