summaryrefslogtreecommitdiffstats
path: root/tests/ui/regions/regions-infer-borrow-scope.rs
blob: b4a050bf1ede08af06e7666a382a95d6ec9bf54d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// run-pass
#![allow(dead_code)]

struct Point {x: isize, y: isize}

fn x_coord(p: &Point) -> &isize {
    return &p.x;
}

pub fn main() {
    let p: Box<_> = Box::new(Point {x: 3, y: 4});
    let xc = x_coord(&*p);
    assert_eq!(*xc, 3);
}