]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/issue-51268.rs
Merge remote-tracking branch 'upstream/master'
[rust.git] / src / test / ui / nll / issue-51268.rs
1 // ignore-tidy-linelength
2
3 #![feature(nll)]
4
5 struct Bar;
6
7 impl Bar {
8     fn bar(&mut self, _: impl Fn()) {}
9 }
10
11 struct Foo {
12     thing: Bar,
13     number: usize,
14 }
15
16 impl Foo {
17     fn foo(&mut self) {
18         self.thing.bar(|| {
19         //~^ ERROR cannot borrow `self.thing` as mutable because it is also borrowed as immutable [E0502]
20             &self.number;
21         });
22     }
23 }
24
25 fn main() {}