]> git.lizzy.rs Git - rust.git/blob - src/test/ui/moves/moves-based-on-type-block-bad.rs
Update tests for changes to cannot move errors
[rust.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                 box E::Foo(_) => {}
24                 box E::Bar(x) => println!("{}", x.to_string()),
25                 box E::Baz => {}
26             }
27         })
28     }
29 }