summaryrefslogtreecommitdiffstats
path: root/tests/ui/unboxed-closures/unboxed-closures-infer-fnmut-move.rs
blob: 7ac1ae30f77cb5c1101d41b2a0e04e177d7bff5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// run-pass
// Test that we are able to infer a suitable kind for this `move`
// closure that is just called (`FnMut`).

fn main() {
    let mut counter = 0;

    let v = {
        let mut tick = move || { counter += 1; counter };
        tick();
        tick()
    };

    assert_eq!(counter, 0);
    assert_eq!(v, 2);
}