FileCheck and rename const_prop_fails_gracefully. · rust-lang/rust@043d29b (original) (raw)
4 files changed
lines changed
File renamed without changes.
File renamed without changes.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
1 | +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY | |
2 | +// unit-test: ConstProp | |
3 | + | |
4 | +#[inline(never)] | |
5 | +fn read(_: usize) { } | |
6 | + | |
7 | +// EMIT_MIR pointer_expose_address.main.ConstProp.diff | |
8 | +fn main() { | |
9 | +// CHECK-LABEL: fn main( | |
10 | +// CHECK: [[ptr:_.*]] = const _; | |
11 | +// CHECK: [[ref:_.*]] = &raw const (*[[ptr]]); | |
12 | +// CHECK: [[x:_.*]] = move [[ref]] as usize (PointerExposeAddress); | |
13 | +// CHECK: [[arg:_.*]] = [[x]]; | |
14 | +// CHECK: = read(move [[arg]]) | |
15 | +const FOO: &i32 = &1; | |
16 | +let x = FOO as *const i32 as usize; | |
17 | +read(x); | |
18 | +} |