rust/tests/ui/raw-ref-op/unusual_locations.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
534 B
Rust
Raw Normal View History

2019-09-18 20:31:25 +00:00
//@ check-pass
2019-11-23 14:22:30 +00:00
#![feature(raw_ref_op)]
2019-09-18 20:31:25 +00:00
const USES_PTR: () = { let u = (); &raw const u; };
static ALSO_USES_PTR: () = { let u = (); &raw const u; };
2019-11-23 14:22:30 +00:00
fn main() {
2019-09-18 20:31:25 +00:00
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 {
_ => {}
2019-11-23 14:22:30 +00:00
}
}
2019-09-18 20:31:25 +00:00
let three = 3;
let mut four = 4;
println!("{:p}", &raw const three);
unsafe { &raw mut four; }
2019-11-23 14:22:30 +00:00
}