2014-01-10 18:30:06 -08:00
|
|
|
// Tests that the borrow checker checks all components of a path when moving
|
|
|
|
// out.
|
|
|
|
|
2021-08-25 02:39:40 +02:00
|
|
|
|
2014-04-03 13:38:45 +13:00
|
|
|
|
2014-01-10 18:30:06 -08:00
|
|
|
struct S {
|
2015-01-08 21:54:35 +11:00
|
|
|
x : Box<isize>
|
2014-01-10 18:30:06 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
fn f<T>(_: T) {}
|
|
|
|
|
|
|
|
fn main() {
|
2021-08-25 02:39:40 +02:00
|
|
|
let a : S = S { x : Box::new(1) };
|
2014-01-10 18:30:06 -08:00
|
|
|
let pb = &a;
|
|
|
|
let S { x: ax } = a; //~ ERROR cannot move out
|
|
|
|
f(pb);
|
|
|
|
}
|