summaryrefslogtreecommitdiffstats
path: root/tests/ui/consts/const-region-ptrs.rs
blob: 9b94a2b1121bd5f42038241f4ab59b715ef0982b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// 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);
}