mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 22:12:15 +00:00
16 lines
328 B
Rust
16 lines
328 B
Rust
// run-pass
|
|
#![allow(non_upper_case_globals)]
|
|
|
|
struct Pair<'a> { a: isize, b: &'a isize }
|
|
|
|
const x: &'static isize = &10;
|
|
|
|
const y: &'static Pair<'static> = &Pair {a: 15, b: x};
|
|
|
|
pub fn main() {
|
|
println!("x = {}", *x);
|
|
println!("y = {{a: {}, b: {}}}", y.a, *(y.b));
|
|
assert_eq!(*x, 10);
|
|
assert_eq!(*(y.b), 10);
|
|
}
|