about summary refs log tree commit diff
path: root/tests/ui/closures/closure-mut-argument-6153.rs
blob: ac19c2bd15fcfc47a1274604ef256e458fc347fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// https://github.com/rust-lang/rust/issues/6153
//@ run-pass

fn swap<F>(f: F) -> Vec<isize> where F: FnOnce(Vec<isize>) -> Vec<isize> {
    let x = vec![1, 2, 3];
    f(x)
}

pub fn main() {
    let v = swap(|mut x| { x.push(4); x });
    let w = swap(|mut x| { x.push(4); x });
    assert_eq!(v, w);
}