mirror of
https://github.com/rust-lang/rust.git
synced 2025-11-30 18:04:34 +00:00
14 lines
305 B
Rust
14 lines
305 B
Rust
// 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);
|
|
}
|