fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1// run-rustfix 2#![allow(dead_code)] 3 4struct Foo { 5 v: Vec<u32>, 6 h: std::collections::HashMap<i32, i32>, 7} 8 9impl 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 18const LOADERS: &Vec<&'static u8> = &Vec::new(); 19 20pub 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 27fn main() {}