mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-06 12:18:33 +00:00
FileCheck and rename const_prop_fails_gracefully.
This commit is contained in:
parent
7f328d2a44
commit
043d29b58a
@ -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);
|
|
||||||
}
|
|
18
tests/mir-opt/const_prop/pointer_expose_address.rs
Normal file
18
tests/mir-opt/const_prop/pointer_expose_address.rs
Normal 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);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user