summaryrefslogtreecommitdiffstats
path: root/src/test/ui/borrowck/borrowck-mut-vec-as-imm-slice.rs
blob: d2b0c01545efe972504cad02be8d6ce959846fd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// run-pass


fn want_slice(v: &[isize]) -> isize {
    let mut sum = 0;
    for i in v { sum += *i; }
    sum
}

fn has_mut_vec(v: Vec<isize> ) -> isize {
    want_slice(&v)
}

pub fn main() {
    assert_eq!(has_mut_vec(vec![1, 2, 3]), 6);
}