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

19 lines
297 B
Rust
Raw Normal View History

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