summary refs log tree commit diff
path: root/src/test/compile-fail/mutable-huh-variance-vec1.rs
blob: 18ca917e8b64b7d24ec2282e7c9db9e2e82f36f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
fn main() {
    // Note: explicit type annot is required here
    // because otherwise the inference gets smart
    // and assigns a type of ~[mut ~[const int]].
    let v: ~[mut ~[int]] = ~[mut ~[0]];

    fn f(&&v: ~[mut ~[const int]]) {
        v[0] = [mut 3]
    }

    f(v); //~ ERROR (values differ in mutability)
}