2023-12-02 14:21:53 -06:00
|
|
|
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
2024-04-20 06:19:34 -05:00
|
|
|
//@ test-mir-pass: GVN
|
2023-12-02 14:21:53 -06:00
|
|
|
|
|
|
|
#[inline(never)]
|
2024-06-02 19:18:33 -05:00
|
|
|
fn read(_: usize) {}
|
2023-12-02 14:21:53 -06:00
|
|
|
|
2024-04-03 08:17:00 -05:00
|
|
|
// EMIT_MIR pointer_expose_provenance.main.GVN.diff
|
2023-12-02 14:21:53 -06:00
|
|
|
fn main() {
|
|
|
|
// CHECK-LABEL: fn main(
|
2024-03-10 08:05:11 -05:00
|
|
|
// CHECK: [[ptr:_.*]] = const main::FOO;
|
2023-12-02 14:21:53 -06:00
|
|
|
// CHECK: [[ref:_.*]] = &raw const (*[[ptr]]);
|
2024-04-03 08:17:00 -05:00
|
|
|
// CHECK: [[x:_.*]] = move [[ref]] as usize (PointerExposeProvenance);
|
2024-08-18 17:51:53 -05:00
|
|
|
// CHECK: = read(copy [[x]])
|
2023-12-02 14:21:53 -06:00
|
|
|
const FOO: &i32 = &1;
|
|
|
|
let x = FOO as *const i32 as usize;
|
|
|
|
read(x);
|
|
|
|
}
|