]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrowck-move-subcomponent.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / 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 }