rust/tests/ui/issues/issue-6153.rs

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

14 lines
256 B
Rust
Raw Normal View History

// 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);
}