summaryrefslogtreecommitdiffstats
path: root/tests/ui/nll/issue-51268.rs
blob: dcdedf7d4c51345cf1c04b8dc3387e75aa60e209 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
struct Bar;

impl Bar {
    fn bar(&mut self, _: impl Fn()) {}
}

struct Foo {
    thing: Bar,
    number: usize,
}

impl Foo {
    fn foo(&mut self) {
        self.thing.bar(|| {
        //~^ ERROR cannot borrow `self.thing` as mutable because it is also borrowed as immutable [E0502]
            &self.number;
        });
    }
}

fn main() {}