rust/src/test/compile-fail/regions-infer-borrow-scope-too-big.rs
2012-07-14 17:37:32 -07:00

15 lines
238 B
Rust

type point = {x: int, y: int};
fn x_coord(p: &point) -> &int {
ret &p.x;
}
fn foo(p: @point) -> &int {
let xc = x_coord(p);
assert *xc == 3;
ret xc; //~ ERROR mismatched types: expected `&int` but found
}
fn main() {}