2023-12-02 14:21:53 -06:00
|
|
|
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
2023-09-20 16:43:33 -05:00
|
|
|
// unit-test: GVN
|
2023-12-02 14:21:53 -06:00
|
|
|
|
|
|
|
#[inline(never)]
|
|
|
|
fn read(_: usize) { }
|
|
|
|
|
2023-09-20 16:43:33 -05:00
|
|
|
// EMIT_MIR pointer_expose_address.main.GVN.diff
|
2023-12-02 14:21:53 -06:00
|
|
|
fn main() {
|
|
|
|
// CHECK-LABEL: fn main(
|
|
|
|
// CHECK: [[ptr:_.*]] = const _;
|
|
|
|
// CHECK: [[ref:_.*]] = &raw const (*[[ptr]]);
|
|
|
|
// CHECK: [[x:_.*]] = move [[ref]] as usize (PointerExposeAddress);
|
2023-09-20 16:43:33 -05:00
|
|
|
// CHECK: = read([[x]])
|
2023-12-02 14:21:53 -06:00
|
|
|
const FOO: &i32 = &1;
|
|
|
|
let x = FOO as *const i32 as usize;
|
|
|
|
read(x);
|
|
|
|
}
|