mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 09:14:20 +00:00
19 lines
265 B
Rust
19 lines
265 B
Rust
// run-pass
|
|
|
|
|
|
fn reverse(v: &mut [usize]) {
|
|
v.reverse();
|
|
}
|
|
|
|
fn bar(v: &mut [usize]) {
|
|
reverse(v);
|
|
reverse(v);
|
|
reverse(v);
|
|
}
|
|
|
|
pub fn main() {
|
|
let mut the_vec = vec![1, 2, 3, 100];
|
|
bar(&mut the_vec);
|
|
assert_eq!(the_vec, [100, 3, 2, 1]);
|
|
}
|