summaryrefslogtreecommitdiffstats
path: root/tests/ui/raw-ref-op/unusual_locations.rs
blob: 6bf37408a8bbdbca2325b98bfd41959601e69e36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// check-pass

#![feature(raw_ref_op)]

const USES_PTR: () = { let u = (); &raw const u; };
static ALSO_USES_PTR: () = { let u = (); &raw const u; };

fn main() {
    let x: [i32; { let u = 2; let x = &raw const u; 4 }]
        = [2; { let v = 3; let y = &raw const v; 4 }];
    let mut one = 1;
    let two = 2;
    if &raw const one == &raw mut one {
        match &raw const two {
            _ => {}
        }
    }
    let three = 3;
    let mut four = 4;
    println!("{:p}", &raw const three);
    unsafe { &raw mut four; }
}