]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / borrowck-for-loop-correct-cmt-for-pattern.rs
1 // Issue #16205.
2
3
4
5 struct Foo {
6     a: [Box<isize>; 3],
7 }
8
9 fn main() {
10     let mut y = 1;
11     let x = Some(&mut y);
12     for &a in x.iter() {    //~ ERROR cannot move out
13     }
14
15     let f = Foo {
16         a: [Box::new(3), Box::new(4), Box::new(5)],
17     };
18     for &a in &f.a {  //~ ERROR cannot move out
19     }
20
21     let x: Option<Box<_>> = Some(Box::new(1));
22     for &a in x.iter() {    //~ ERROR cannot move out
23     }
24 }