fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1//run-rustfix 2#![allow(unused)] 3 4struct S; 5impl S { 6 fn foo(&mut self) { 7 let x = |this: &Self, v: i32| { 8 this.bar(); 9 this.hel(); 10 }; 11 self.qux(); //~ ERROR cannot borrow `*self` as mutable because it is also borrowed as immutable 12 x(self, 1); 13 x(self, 3); 14 } 15 fn bar(&self) {} 16 fn hel(&self) {} 17 fn qux(&mut self) {} 18 19 fn hello(&mut self) { 20 let y = |this: &Self| { 21 this.bar(); 22 }; 23 self.qux(); //~ ERROR cannot borrow `*self` as mutable because it is also borrowed as immutable 24 y(self); 25 } 26} 27 28fn main() {}