/src/test/compile-fail/writing-through-read-alias.rs

http://github.com/jruderman/rust · Rust · 9 lines · 3 code · 4 blank · 2 comment · 0 complexity · f9f9d4c450d740ef4ee8c56c81339df1 MD5 · raw file

  1. // -*- rust -*-
  2. // error-pattern:assigning to immutable field
  3. type point = {x: int, y: int, z: int};
  4. fn f(p: point) { p.x = 13; }
  5. fn main() { let x: point = {x: 10, y: 11, z: 12}; f(x); }