summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.fixed
blob: 85acafd88f6719d4ef49b4bc6073cb09820a339f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// run-rustfix
// Test that a by-ref `FnMut` closure gets an error when it tries to
// consume a value.

fn call<F>(f: F) where F : Fn() {
    f();
}

fn main() {
    let y = vec![format!("World")];
    call(|| {
        <Vec<String> as Clone>::clone(&y).into_iter();
        //~^ ERROR cannot move out of `y`, a captured variable in an `Fn` closure
    });
}