2012-07-06 11:14:57 -05:00
|
|
|
type point = {x: int, y: int};
|
|
|
|
|
|
|
|
fn x_coord(p: &point) -> &int {
|
2012-08-01 19:30:05 -05:00
|
|
|
return &p.x;
|
2012-07-06 11:14:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn foo(p: @point) -> &int {
|
2012-07-26 10:51:57 -05:00
|
|
|
let xc = x_coord(p); //~ ERROR illegal borrow
|
2012-07-06 11:14:57 -05:00
|
|
|
assert *xc == 3;
|
2012-08-01 19:30:05 -05:00
|
|
|
return xc;
|
2012-07-06 11:14:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|
|
|
|
|