]> git.proxmox.com Git - rustc.git/blob - src/test/ui/borrowck/borrowck-move-subcomponent.rs
New upstream version 1.57.0+dfsg1
[rustc.git] / src / test / ui / borrowck / borrowck-move-subcomponent.rs
1 // Tests that the borrow checker checks all components of a path when moving
2 // out.
3
4
5
6 struct S {
7 x : Box<isize>
8 }
9
10 fn f<T>(_: T) {}
11
12 fn main() {
13 let a : S = S { x : Box::new(1) };
14 let pb = &a;
15 let S { x: ax } = a; //~ ERROR cannot move out
16 f(pb);
17 }