]> git.proxmox.com Git - rustc.git/blob - tests/ui/issues/issue-21600.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / issues / issue-21600.rs
1 fn call_it<F>(f: F) where F: Fn() { f(); }
2
3 struct A;
4
5 impl A {
6 fn gen(&self) {}
7 fn gen_mut(&mut self) {}
8 }
9
10 fn main() {
11 let mut x = A;
12 call_it(|| {
13 call_it(|| x.gen());
14 call_it(|| x.gen_mut());
15 //~^ ERROR cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
16 //~| ERROR cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
17 });
18 }