summary refs log tree commit diff
path: root/src/test/ui/borrowck/borrowck-move-subcomponent.rs
blob: 4185632c4e2919e05f60d18e0115d3fad3319a6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// 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);
}