summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.rs
blob: 389b8a43c0551391d9c8a8c74cee0e5d5b64317c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Issue #16205.



struct Foo {
    a: [Box<isize>; 3],
}

fn main() {
    let mut y = 1;
    let x = Some(&mut y);
    for &a in x.iter() {    //~ ERROR cannot move out
    }

    let f = Foo {
        a: [Box::new(3), Box::new(4), Box::new(5)],
    };
    for &a in &f.a {  //~ ERROR cannot move out
    }

    let x: Option<Box<_>> = Some(Box::new(1));
    for &a in x.iter() {    //~ ERROR cannot move out
    }
}