rust/src/test/compile-fail/regions-infer-borrow-scope-too-big.rs
2012-08-01 19:16:06 -07:00

15 lines
215 B
Rust

type point = {x: int, y: int};
fn x_coord(p: &point) -> &int {
return &p.x;
}
fn foo(p: @point) -> &int {
let xc = x_coord(p); //~ ERROR illegal borrow
assert *xc == 3;
return xc;
}
fn main() {}