summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/issue-17718-borrow-interior.rs
blob: 5861f2186899bd4b741238a8ac2df2639ffefa50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// run-pass
#![allow(dead_code)]
struct S { a: usize }

static A: S = S { a: 3 };
static B: &'static usize = &A.a;
static C: &'static usize = &(A.a);

static D: [usize; 1] = [1];
static E: usize = D[0];
static F: &'static usize = &D[0];

fn main() {
    assert_eq!(*B, A.a);
    assert_eq!(*B, A.a);

    assert_eq!(E, D[0]);
    assert_eq!(*F, D[0]);
}