]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/issue-105761-suggest-self-for-closure.fixed
Rollup merge of #106670 - albertlarsan68:check-docs-in-pr-ci, r=Mark-Simulacrum
[rust.git] / tests / ui / suggestions / issue-105761-suggest-self-for-closure.fixed
1 //run-rustfix
2 #![allow(unused)]
3
4 struct S;
5 impl 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
28 fn main() {}