2024-02-16 20:02:50 +00:00
|
|
|
//@ run-pass
|
2015-01-18 19:43:35 +09:00
|
|
|
// 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 21:15:45 +03:00
|
|
|
assert_eq!(v, [0]);
|
2015-01-18 19:43:35 +09:00
|
|
|
}
|