mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
14 lines
243 B
Rust
14 lines
243 B
Rust
//@ 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);
|
|
}
|