summaryrefslogtreecommitdiffstats
path: root/tests/ui/unboxed-closures/unboxed-closures-infer-upvar.rs
blob: 6a5e5b9c224b925e51c088e7ff1837739a1dcfb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// run-pass
// Test that the type variable in the type(`Vec<_>`) of a closed over
// variable does not interfere with type inference.

fn f<F: FnMut()>(mut f: F) {
    f();
}

fn main() {
    let mut v: Vec<_> = vec![];
    f(|| v.push(0));
    assert_eq!(v, [0]);
}