]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/for-i-in-vec.fixed
Rollup merge of #107559 - WaffleLapkin:is_it_2015¿, r=davidtwco
[rust.git] / tests / ui / suggestions / for-i-in-vec.fixed
1 // run-rustfix
2 #![allow(dead_code)]
3
4 struct Foo {
5     v: Vec<u32>,
6     h: std::collections::HashMap<i32, i32>,
7 }
8
9 impl Foo {
10     fn bar(&self) {
11         for _ in &self.v { //~ ERROR cannot move out of `self.v` which is behind a shared reference
12         }
13         for _ in &self.h { //~ ERROR cannot move out of `self.h` which is behind a shared reference
14         }
15     }
16 }
17
18 const LOADERS: &Vec<&'static u8> = &Vec::new();
19
20 pub fn break_code() -> Option<&'static u8> {
21     for loader in &*LOADERS { //~ ERROR cannot move out of a shared reference
22         return Some(loader);
23     }
24     None
25 }
26
27 fn main() {}