summary refs log tree commit diff
path: root/src/test/compile-fail/mutable-huh-variance-vec3.rs
blob: 97b6ccabdfd219d2e827fb2e22d1488574617ce5 (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[mut[int]]] = [mut [mut [0]]];

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

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