rust/src/test/compile-fail/mutable-huh-variance-vec3.rs

13 lines
353 B
Rust
Raw Normal View History

fn main() {
2012-03-22 20:06:01 -07:00
// 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]]] = [mutable [mutable [0]]];
2011-11-16 14:41:32 -08:00
fn f(&&v: [mutable [mutable [const int]]]) {
v[0][1] = [mutable 3]
}
2012-03-22 20:06:01 -07:00
f(v); //! ERROR (values differ in mutability)
}