summaryrefslogtreecommitdiff
path: root/tests/ui/borrowck/issue-87456-point-to-closure.rs
blob: 9fc12ba74904267249bd12963ec30949ec60b077 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Regression test for #87456.

fn take_mut(_val: impl FnMut()) {}

fn main() {
    let val = String::new();
    //~^ NOTE: captured outer variable
    take_mut(|| {
    //~^ NOTE: captured by this `FnMut` closure
        let _foo: String = val;
        //~^ ERROR: cannot move out of `val`, a captured variable in an `FnMut` closure [E0507]
        //~| NOTE: move occurs because
    })
}