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