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) {
|
2011-05-02 19:47:24 -05:00
|
|
|
assert (p.z == 12);
|
2010-06-23 23:03:09 -05:00
|
|
|
p.z = 13;
|
2011-05-02 19:47:24 -05:00
|
|
|
assert (p.z == 13);
|
2010-06-23 23:03:09 -05:00
|
|
|
}
|
|
|
|
|
2011-04-19 15:35:49 -05:00
|
|
|
fn main() {
|
2010-07-15 17:20:04 -05:00
|
|
|
let point a = rec(x=10, y=11, mutable z=12);
|
2010-06-30 23:17:45 -05:00
|
|
|
let @point b = @a;
|
2011-05-02 19:47:24 -05:00
|
|
|
assert (b.z == 12);
|
2010-06-23 23:03:09 -05:00
|
|
|
f(b);
|
2011-05-02 19:47:24 -05:00
|
|
|
assert (a.z == 12);
|
|
|
|
assert (b.z == 13);
|
2010-06-23 23:03:09 -05:00
|
|
|
}
|