2018-08-30 14:18:55 +02:00
|
|
|
// run-pass
|
2018-09-25 23:51:35 +02:00
|
|
|
#![allow(dead_code)]
|
2013-12-11 23:17:54 -08:00
|
|
|
|
2015-03-25 17:06:52 -07:00
|
|
|
struct Point {x: isize, y: isize}
|
2012-07-06 09:14:57 -07:00
|
|
|
|
2015-03-25 17:06:52 -07:00
|
|
|
fn x_coord(p: &Point) -> &isize {
|
2012-08-01 17:30:05 -07:00
|
|
|
return &p.x;
|
2012-07-06 09:14:57 -07:00
|
|
|
}
|
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() {
|
2021-08-25 02:39:40 +02:00
|
|
|
let p: Box<_> = Box::new(Point {x: 3, y: 4});
|
2014-07-07 16:35:15 -07:00
|
|
|
let xc = x_coord(&*p);
|
2013-05-18 22:02:45 -04:00
|
|
|
assert_eq!(*xc, 3);
|
2012-07-06 09:14:57 -07:00
|
|
|
}
|