2018-08-30 14:18:55 +02:00
|
|
|
// run-pass
|
2018-08-31 15:02:01 +02:00
|
|
|
#![allow(non_upper_case_globals)]
|
|
|
|
|
2015-03-25 17:06:52 -07:00
|
|
|
struct Pair<'a> { a: isize, b: &'a isize }
|
2013-01-25 22:46:32 -08:00
|
|
|
|
2015-03-25 17:06:52 -07:00
|
|
|
const x: &'static isize = &10;
|
2012-08-03 18:07:45 -07:00
|
|
|
|
2014-10-06 21:16:35 -07:00
|
|
|
const y: &'static Pair<'static> = &Pair {a: 15, b: x};
|
2012-08-03 18:07:45 -07:00
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() {
|
2013-09-24 22:16:43 -07:00
|
|
|
println!("x = {}", *x);
|
2014-05-28 09:24:28 -07:00
|
|
|
println!("y = {{a: {}, b: {}}}", y.a, *(y.b));
|
2013-05-18 22:02:45 -04:00
|
|
|
assert_eq!(*x, 10);
|
|
|
|
assert_eq!(*(y.b), 10);
|
2012-08-03 18:07:45 -07:00
|
|
|
}
|