FileCheck and rename const_prop_fails_gracefully.

This commit is contained in:
Camille GILLOT 2023-12-02 20:21:53 +00:00
parent 7f328d2a44
commit 043d29b58a
4 changed files with 18 additions and 12 deletions

View File

@ -1,12 +0,0 @@
// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
#[inline(never)]
fn read(_: usize) { }
// EMIT_MIR const_prop_fails_gracefully.main.ConstProp.diff
fn main() {
const FOO: &i32 = &1;
let x = FOO as *const i32 as usize;
read(x);
}

View File

@ -0,0 +1,18 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
#[inline(never)]
fn read(_: usize) { }
// EMIT_MIR pointer_expose_address.main.ConstProp.diff
fn main() {
// CHECK-LABEL: fn main(
// CHECK: [[ptr:_.*]] = const _;
// CHECK: [[ref:_.*]] = &raw const (*[[ptr]]);
// CHECK: [[x:_.*]] = move [[ref]] as usize (PointerExposeAddress);
// CHECK: [[arg:_.*]] = [[x]];
// CHECK: = read(move [[arg]])
const FOO: &i32 = &1;
let x = FOO as *const i32 as usize;
read(x);
}