rust/src/test/compile-fail/writing-through-read-alias.rs
Marijn Haverbeke 0ddade3d7a Extend alias analysis to check assignments
This is a somewhat odd place to put these checks, but the data tracked
by that pass, and the available functions, make it trivial to do such
a check there.
2011-06-15 14:10:07 +02:00

16 lines
214 B
Rust

// xfail-stage0
// -*- rust -*-
// error-pattern:assignment to immutable field
type point = rec(int x, int y, int z);
fn f(&point p) {
p.x = 13;
}
fn main() {
let point x = rec(x=10, y=11, z=12);
f(x);
}