rust/src/test/ui/borrowck/borrowck-move-subcomponent.rs
2018-12-25 21:08:33 -07:00

18 lines
279 B
Rust

// Tests that the borrow checker checks all components of a path when moving
// out.
#![feature(box_syntax)]
struct S {
x : Box<isize>
}
fn f<T>(_: T) {}
fn main() {
let a : S = S { x : box 1 };
let pb = &a;
let S { x: ax } = a; //~ ERROR cannot move out
f(pb);
}