summaryrefslogtreecommitdiffstats
path: root/tests/ui/coercion/coerce-reborrow-mut-vec-arg.rs
blob: 2635754f14dacddea066a94009fcca92a1f434ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// 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]);
}