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

14 lines
197 B
Rust
Raw Normal View History

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