]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/issue-105761-suggest-self-for-closure.rs
Rollup merge of #106829 - compiler-errors:more-alias-combine, r=spastorino
[rust.git] / tests / ui / suggestions / issue-105761-suggest-self-for-closure.rs
1 //run-rustfix
2 #![allow(unused)]
3
4 struct S;
5 impl S {
6     fn foo(&mut self) {
7         let x = |v: i32| {
8             self.bar();
9             self.hel();
10         };
11         self.qux(); //~ ERROR cannot borrow `*self` as mutable because it is also borrowed as immutable
12         x(1);
13         x(3);
14     }
15     fn bar(&self) {}
16     fn hel(&self) {}
17     fn qux(&mut self) {}
18
19     fn hello(&mut self) {
20         let y = || {
21             self.bar();
22         };
23         self.qux(); //~ ERROR cannot borrow `*self` as mutable because it is also borrowed as immutable
24         y();
25     }
26 }
27
28 fn main() {}