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