Skip to content

Commit

Permalink
FileCheck and rename const_prop_fails_gracefully.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Dec 2, 2023
1 parent 7f328d2 commit 043d29b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
12 changes: 0 additions & 12 deletions tests/mir-opt/const_prop/const_prop_fails_gracefully.rs

This file was deleted.

18 changes: 18 additions & 0 deletions tests/mir-opt/const_prop/pointer_expose_address.rs
Original file line number Diff line number Diff line change
@@ -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);
}

0 comments on commit 043d29b

Please sign in to comment.