]> git.proxmox.com Git - rustc.git/blob - src/test/ui/moves/moves-based-on-type-block-bad.rs
New upstream version 1.36.0+dfsg1
[rustc.git] / src / test / ui / moves / moves-based-on-type-block-bad.rs
1 #![feature(box_patterns)]
2 #![feature(box_syntax)]
3
4 struct S {
5 x: Box<E>
6 }
7
8 enum E {
9 Foo(Box<S>),
10 Bar(Box<isize>),
11 Baz
12 }
13
14 fn f<G>(s: &S, g: G) where G: FnOnce(&S) {
15 g(s)
16 }
17
18 fn main() {
19 let s = S { x: box E::Bar(box 42) };
20 loop {
21 f(&s, |hellothere| {
22 match hellothere.x { //~ ERROR cannot move out
23 //~| cannot move out of borrowed content
24 box E::Foo(_) => {}
25 box E::Bar(x) => println!("{}", x.to_string()),
26 box E::Baz => {}
27 }
28 })
29 }
30 }