summary refs log tree commit diff
path: root/src/test/ui/issues/issue-21600.rs
blob: 1efc873bee2668ccc0c0934610cc213cede77605 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
fn call_it<F>(f: F) where F: Fn() { f(); }

struct A;

impl A {
    fn gen(&self) {}
    fn gen_mut(&mut self) {}
}

fn main() {
    let mut x = A;
    call_it(|| {
        call_it(|| x.gen());
        call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer
        //~^ ERROR cannot borrow data mutably in a captured outer
    });
}