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

16 lines
304 B
Rust
Raw Normal View History

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