rust/tests/ui/unboxed-closures/unboxed-closures-infer-upvar.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
267 B
Rust
Raw Normal View History

// 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));
2015-02-24 12:15:45 -06:00
assert_eq!(v, [0]);
}