rust/src/test/run-pass/writealias.rs

14 lines
196 B
Rust
Raw Normal View History

2010-06-23 21:03:09 -07:00
// -*- rust -*-
2011-07-27 14:19:39 +02:00
type point = {x: int, y: int, mutable z: int};
2010-06-23 21:03:09 -07:00
2011-09-12 12:39:38 +02:00
fn f(&p: point) { p.z = 13; }
2010-06-23 21:03:09 -07:00
2011-04-19 13:35:49 -07:00
fn main() {
2011-07-27 14:19:39 +02:00
let x: point = {x: 10, y: 11, mutable z: 12};
f(x);
assert (x.z == 13);
}