make some const prop tests unit-test

This commit is contained in:
Nilstrieb 2022-07-26 19:04:27 +02:00 committed by Nils Heydecker
parent 36f4f4aa38
commit ee30cc8b20
42 changed files with 60 additions and 38 deletions

View file

@ -24,7 +24,7 @@
+ _1 = const 1_i32; // scope 0 at $DIR/aggregate.rs:+1:13: +1:28
StorageDead(_2); // scope 0 at $DIR/aggregate.rs:+1:27: +1:28
StorageDead(_3); // scope 0 at $DIR/aggregate.rs:+1:28: +1:29
nop; // scope 0 at $DIR/aggregate.rs:+0:11: +2:2
_0 = const (); // scope 0 at $DIR/aggregate.rs:+0:11: +2:2
StorageDead(_1); // scope 0 at $DIR/aggregate.rs:+2:1: +2:2
return; // scope 0 at $DIR/aggregate.rs:+2:2: +2:2
}

View file

@ -1,3 +1,4 @@
// unit-test: ConstProp
// compile-flags: -O
// EMIT_MIR aggregate.main.ConstProp.diff

View file

@ -18,11 +18,12 @@
_2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32]; // scope 0 at $DIR/array_index.rs:+1:18: +1:30
StorageLive(_3); // scope 0 at $DIR/array_index.rs:+1:31: +1:32
_3 = const 2_usize; // scope 0 at $DIR/array_index.rs:+1:31: +1:32
_4 = const 4_usize; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
- _4 = Len(_2); // scope 0 at $DIR/array_index.rs:+1:18: +1:33
- _5 = Lt(_3, _4); // scope 0 at $DIR/array_index.rs:+1:18: +1:33
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
+ _4 = const 4_usize; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
+ _5 = const true; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> bb1; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
}
bb1: {
@ -30,7 +31,7 @@
+ _1 = const 2_u32; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
StorageDead(_3); // scope 0 at $DIR/array_index.rs:+1:33: +1:34
StorageDead(_2); // scope 0 at $DIR/array_index.rs:+1:33: +1:34
nop; // scope 0 at $DIR/array_index.rs:+0:11: +2:2
_0 = const (); // scope 0 at $DIR/array_index.rs:+0:11: +2:2
StorageDead(_1); // scope 0 at $DIR/array_index.rs:+2:1: +2:2
return; // scope 0 at $DIR/array_index.rs:+2:2: +2:2
}

View file

@ -18,11 +18,12 @@
_2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32]; // scope 0 at $DIR/array_index.rs:+1:18: +1:30
StorageLive(_3); // scope 0 at $DIR/array_index.rs:+1:31: +1:32
_3 = const 2_usize; // scope 0 at $DIR/array_index.rs:+1:31: +1:32
_4 = const 4_usize; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
- _4 = Len(_2); // scope 0 at $DIR/array_index.rs:+1:18: +1:33
- _5 = Lt(_3, _4); // scope 0 at $DIR/array_index.rs:+1:18: +1:33
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
+ _4 = const 4_usize; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
+ _5 = const true; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> bb1; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
}
bb1: {
@ -30,7 +31,7 @@
+ _1 = const 2_u32; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
StorageDead(_3); // scope 0 at $DIR/array_index.rs:+1:33: +1:34
StorageDead(_2); // scope 0 at $DIR/array_index.rs:+1:33: +1:34
nop; // scope 0 at $DIR/array_index.rs:+0:11: +2:2
_0 = const (); // scope 0 at $DIR/array_index.rs:+0:11: +2:2
StorageDead(_1); // scope 0 at $DIR/array_index.rs:+2:1: +2:2
return; // scope 0 at $DIR/array_index.rs:+2:2: +2:2
}

View file

@ -1,3 +1,4 @@
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR array_index.main.ConstProp.diff

View file

@ -24,10 +24,9 @@
StorageLive(_3); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19
- _3 = _1; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19
- _4 = Eq(_3, const 0_i32); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
- assert(!move _4, "attempt to divide `{}` by zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
+ _3 = const 0_i32; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19
+ _4 = const true; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
+ assert(!const true, "attempt to divide `{}` by zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
assert(!move _4, "attempt to divide `{}` by zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
}
bb1: {
@ -38,14 +37,13 @@
+ _5 = const false; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
+ _6 = const false; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
+ _7 = const false; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
+ assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, const 0_i32) -> bb2; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
+ assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, _3) -> bb2; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
}
bb2: {
- _2 = Div(const 1_i32, move _3); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
+ _2 = Div(const 1_i32, const 0_i32); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
_2 = Div(const 1_i32, move _3); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
StorageDead(_3); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19
nop; // scope 0 at $DIR/bad_op_div_by_zero.rs:+0:11: +3:2
_0 = const (); // scope 0 at $DIR/bad_op_div_by_zero.rs:+0:11: +3:2
StorageDead(_2); // scope 1 at $DIR/bad_op_div_by_zero.rs:+3:1: +3:2
StorageDead(_1); // scope 0 at $DIR/bad_op_div_by_zero.rs:+3:1: +3:2
return; // scope 0 at $DIR/bad_op_div_by_zero.rs:+3:2: +3:2

View file

@ -1,3 +1,4 @@
// unit-test: ConstProp
// EMIT_MIR bad_op_div_by_zero.main.ConstProp.diff
#[allow(unconditional_panic)]
fn main() {

View file

@ -1,3 +1,4 @@
// unit-test: ConstProp
// compile-flags: -O -Zmir-opt-level=4
// EMIT_MIR boolean_identities.test.ConstProp.diff

View file

@ -26,12 +26,11 @@
StorageLive(_3); // scope 0 at $DIR/boxes.rs:+1:14: +1:22
- _4 = SizeOf(i32); // scope 2 at $DIR/boxes.rs:+1:14: +1:22
- _5 = AlignOf(i32); // scope 2 at $DIR/boxes.rs:+1:14: +1:22
- _6 = alloc::alloc::exchange_malloc(move _4, move _5) -> bb1; // scope 2 at $DIR/boxes.rs:+1:14: +1:22
+ _4 = const 4_usize; // scope 2 at $DIR/boxes.rs:+1:14: +1:22
+ _5 = const 4_usize; // scope 2 at $DIR/boxes.rs:+1:14: +1:22
+ _6 = alloc::alloc::exchange_malloc(const 4_usize, const 4_usize) -> bb1; // scope 2 at $DIR/boxes.rs:+1:14: +1:22
_6 = alloc::alloc::exchange_malloc(move _4, move _5) -> bb1; // scope 2 at $DIR/boxes.rs:+1:14: +1:22
// mir::Constant
// + span: $DIR/boxes.rs:12:14: 12:22
// + span: $DIR/boxes.rs:13:14: 13:22
// + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(<ZST>) }
}
@ -55,7 +54,7 @@
bb2: {
StorageDead(_3); // scope 0 at $DIR/boxes.rs:+1:26: +1:27
nop; // scope 0 at $DIR/boxes.rs:+0:11: +2:2
_0 = const (); // scope 0 at $DIR/boxes.rs:+0:11: +2:2
StorageDead(_1); // scope 0 at $DIR/boxes.rs:+2:1: +2:2
return; // scope 0 at $DIR/boxes.rs:+2:2: +2:2
}

View file

@ -1,3 +1,4 @@
// unit-test: ConstProp
// compile-flags: -O
// ignore-emscripten compiled with panic=abort by default
// ignore-wasm32

View file

@ -19,7 +19,7 @@
StorageLive(_2); // scope 1 at $DIR/cast.rs:+3:9: +3:10
- _2 = const 42_u32 as u8 (Misc); // scope 1 at $DIR/cast.rs:+3:13: +3:24
+ _2 = const 42_u8; // scope 1 at $DIR/cast.rs:+3:13: +3:24
nop; // scope 0 at $DIR/cast.rs:+0:11: +4:2
_0 = const (); // scope 0 at $DIR/cast.rs:+0:11: +4:2
StorageDead(_2); // scope 1 at $DIR/cast.rs:+4:1: +4:2
StorageDead(_1); // scope 0 at $DIR/cast.rs:+4:1: +4:2
return; // scope 0 at $DIR/cast.rs:+4:2: +4:2

View file

@ -1,3 +1,4 @@
// unit-test: ConstProp
// EMIT_MIR cast.main.ConstProp.diff
fn main() {

View file

@ -20,7 +20,7 @@
bb1: {
- _1 = move (_2.0: u32); // scope 0 at $DIR/checked_add.rs:+1:18: +1:23
+ _1 = const 2_u32; // scope 0 at $DIR/checked_add.rs:+1:18: +1:23
nop; // scope 0 at $DIR/checked_add.rs:+0:11: +2:2
_0 = const (); // scope 0 at $DIR/checked_add.rs:+0:11: +2:2
StorageDead(_1); // scope 0 at $DIR/checked_add.rs:+2:1: +2:2
return; // scope 0 at $DIR/checked_add.rs:+2:2: +2:2
}

View file

@ -1,3 +1,4 @@
// unit-test: ConstProp
// compile-flags: -C overflow-checks=on
// EMIT_MIR checked_add.main.ConstProp.diff

View file

@ -18,7 +18,7 @@
StorageLive(_3); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16
_3 = const FOO; // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16
// mir::Constant
// + span: $DIR/const_prop_fails_gracefully.rs:7:13: 7:16
// + span: $DIR/const_prop_fails_gracefully.rs:8:13: 8:16
// + literal: Const { ty: &i32, val: Unevaluated(FOO, [], None) }
_2 = &raw const (*_3); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16
_1 = move _2 as usize (PointerExposeAddress); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:39
@ -29,14 +29,14 @@
_5 = _1; // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:10: +3:11
_4 = read(move _5) -> bb1; // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:5: +3:12
// mir::Constant
// + span: $DIR/const_prop_fails_gracefully.rs:8:5: 8:9
// + span: $DIR/const_prop_fails_gracefully.rs:9:5: 9:9
// + literal: Const { ty: fn(usize) {read}, val: Value(<ZST>) }
}
bb1: {
StorageDead(_5); // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:11: +3:12
StorageDead(_4); // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:12: +3:13
nop; // scope 0 at $DIR/const_prop_fails_gracefully.rs:+0:11: +4:2
_0 = const (); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+0:11: +4:2
StorageDead(_1); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+4:1: +4:2
return; // scope 0 at $DIR/const_prop_fails_gracefully.rs:+4:2: +4:2
}

View file

@ -1,3 +1,4 @@
// unit-test: ConstProp
#[inline(never)]
fn read(_: usize) { }

View file

@ -1,10 +1,11 @@
// unit-test: ConstProp
// compile-flags: -Zmir-opt-level=1
trait NeedsDrop:Sized{
const NEEDS:bool=std::mem::needs_drop::<Self>();
trait NeedsDrop: Sized {
const NEEDS: bool = std::mem::needs_drop::<Self>();
}
impl<This> NeedsDrop for This{}
impl<This> NeedsDrop for This {}
// EMIT_MIR control_flow_simplification.hello.ConstProp.diff
// EMIT_MIR control_flow_simplification.hello.PreCodegen.before.mir

View file

@ -44,7 +44,7 @@
_1 = Add(move _2, const 0_i32); // scope 0 at $DIR/discriminant.rs:+1:13: +1:68
StorageDead(_2); // scope 0 at $DIR/discriminant.rs:+1:67: +1:68
StorageDead(_3); // scope 0 at $DIR/discriminant.rs:+1:68: +1:69
nop; // scope 0 at $DIR/discriminant.rs:+0:11: +2:2
_0 = const (); // scope 0 at $DIR/discriminant.rs:+0:11: +2:2
StorageDead(_1); // scope 0 at $DIR/discriminant.rs:+2:1: +2:2
return; // scope 0 at $DIR/discriminant.rs:+2:2: +2:2
}

View file

@ -44,7 +44,7 @@
_1 = Add(move _2, const 0_i32); // scope 0 at $DIR/discriminant.rs:+1:13: +1:68
StorageDead(_2); // scope 0 at $DIR/discriminant.rs:+1:67: +1:68
StorageDead(_3); // scope 0 at $DIR/discriminant.rs:+1:68: +1:69
nop; // scope 0 at $DIR/discriminant.rs:+0:11: +2:2
_0 = const (); // scope 0 at $DIR/discriminant.rs:+0:11: +2:2
StorageDead(_1); // scope 0 at $DIR/discriminant.rs:+2:1: +2:2
return; // scope 0 at $DIR/discriminant.rs:+2:2: +2:2
}

View file

@ -1,3 +1,4 @@
// unit-test: ConstProp
// compile-flags: -O
// FIXME(wesleywiser): Ideally, we could const-prop away all of this and just be left with

View file

@ -18,14 +18,14 @@
- assert(!move (_3.1: bool), "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> bb1; // scope 0 at $DIR/indirect.rs:+1:13: +1:29
+ _2 = const 2_u8; // scope 0 at $DIR/indirect.rs:+1:13: +1:25
+ _3 = const (3_u8, false); // scope 0 at $DIR/indirect.rs:+1:13: +1:29
+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u8, const 1_u8) -> bb1; // scope 0 at $DIR/indirect.rs:+1:13: +1:29
+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> bb1; // scope 0 at $DIR/indirect.rs:+1:13: +1:29
}
bb1: {
- _1 = move (_3.0: u8); // scope 0 at $DIR/indirect.rs:+1:13: +1:29
+ _1 = const 3_u8; // scope 0 at $DIR/indirect.rs:+1:13: +1:29
StorageDead(_2); // scope 0 at $DIR/indirect.rs:+1:28: +1:29
nop; // scope 0 at $DIR/indirect.rs:+0:11: +2:2
_0 = const (); // scope 0 at $DIR/indirect.rs:+0:11: +2:2
StorageDead(_1); // scope 0 at $DIR/indirect.rs:+2:1: +2:2
return; // scope 0 at $DIR/indirect.rs:+2:2: +2:2
}

View file

@ -1,3 +1,4 @@
// unit-test: ConstProp
// compile-flags: -C overflow-checks=on
// EMIT_MIR indirect.main.ConstProp.diff

View file

@ -1,3 +1,4 @@
// unit-test: ConstProp
// compile-flags: -Z mir-opt-level=3
// Due to a bug in propagating scalar pairs the assertion below used to fail. In the expected

View file

@ -1,3 +1,4 @@
// unit-test: ConstProp
// compile-flags: -Z mir-opt-level=3
// This used to ICE in const-prop

View file

@ -19,7 +19,7 @@
StorageDead(_3); // scope 0 at $DIR/issue-66971.rs:+1:21: +1:22
_1 = encode(move _2) -> bb1; // scope 0 at $DIR/issue-66971.rs:+1:5: +1:23
// mir::Constant
// + span: $DIR/issue-66971.rs:16:5: 16:11
// + span: $DIR/issue-66971.rs:17:5: 17:11
// + literal: Const { ty: fn(((), u8, u8)) {encode}, val: Value(<ZST>) }
}

View file

@ -20,7 +20,7 @@
StorageDead(_3); // scope 0 at $DIR/issue-67019.rs:+1:18: +1:19
_1 = test(move _2) -> bb1; // scope 0 at $DIR/issue-67019.rs:+1:5: +1:20
// mir::Constant
// + span: $DIR/issue-67019.rs:11:5: 11:9
// + span: $DIR/issue-67019.rs:12:5: 12:9
// + literal: Const { ty: fn(((u8, u8),)) {test}, val: Value(<ZST>) }
}

View file

@ -1,3 +1,4 @@
// unit-test
// compile-flags: -O -Zmir-opt-level=4
// EMIT_MIR mult_by_zero.test.ConstProp.diff

View file

@ -1,3 +1,4 @@
// unit-test
// compile-flags: -O
// EMIT_MIR mutable_variable.main.ConstProp.diff

View file

@ -1,3 +1,4 @@
// unit-test
// compile-flags: -O
// EMIT_MIR mutable_variable_aggregate.main.ConstProp.diff

View file

@ -1,3 +1,4 @@
// unit-test
// compile-flags: -O
// EMIT_MIR mutable_variable_aggregate_mut_ref.main.ConstProp.diff

View file

@ -16,7 +16,7 @@
StorageLive(_1); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:9: +1:14
_1 = foo() -> bb1; // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:29: +1:34
// mir::Constant
// + span: $DIR/mutable_variable_aggregate_partial_read.rs:5:29: 5:32
// + span: $DIR/mutable_variable_aggregate_partial_read.rs:6:29: 6:32
// + literal: Const { ty: fn() -> (i32, i32) {foo}, val: Value(<ZST>) }
}

View file

@ -1,3 +1,4 @@
// unit-test
// compile-flags: -O
// EMIT_MIR mutable_variable_aggregate_partial_read.main.ConstProp.diff

View file

@ -25,7 +25,7 @@
StorageLive(_4); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19
_4 = const {alloc1: *mut u32}; // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19
// mir::Constant
// + span: $DIR/mutable_variable_no_prop.rs:9:13: 9:19
// + span: $DIR/mutable_variable_no_prop.rs:10:13: 10:19
// + literal: Const { ty: *mut u32, val: Value(Scalar(alloc1)) }
_3 = (*_4); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19
_1 = move _3; // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:9: +3:19

View file

@ -1,3 +1,4 @@
// unit-test
// compile-flags: -O
static mut STATIC: u32 = 42;

View file

@ -25,7 +25,7 @@
StorageLive(_1); // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+1:9: +1:10
_1 = foo() -> bb1; // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+1:13: +1:18
// mir::Constant
// + span: $DIR/mutable_variable_unprop_assign.rs:5:13: 5:16
// + span: $DIR/mutable_variable_unprop_assign.rs:6:13: 6:16
// + literal: Const { ty: fn() -> i32 {foo}, val: Value(<ZST>) }
}

View file

@ -1,3 +1,4 @@
// unit-test
// compile-flags: -O
// EMIT_MIR mutable_variable_unprop_assign.main.ConstProp.diff

View file

@ -1,3 +1,4 @@
// unit-test
// compile-flags: -C overflow-checks=on
struct Point {

View file

@ -18,7 +18,7 @@
StorageLive(_3); // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16
_3 = const {alloc1: &u8}; // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16
// mir::Constant
// + span: $DIR/read_immutable_static.rs:7:13: 7:16
// + span: $DIR/read_immutable_static.rs:8:13: 8:16
// + literal: Const { ty: &u8, val: Value(Scalar(alloc1)) }
- _2 = (*_3); // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16
+ _2 = const 2_u8; // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16
@ -26,7 +26,7 @@
StorageLive(_5); // scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22
_5 = const {alloc1: &u8}; // scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22
// mir::Constant
// + span: $DIR/read_immutable_static.rs:7:19: 7:22
// + span: $DIR/read_immutable_static.rs:8:19: 8:22
// + literal: Const { ty: &u8, val: Value(Scalar(alloc1)) }
- _4 = (*_5); // scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22
- _1 = Add(move _2, move _4); // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:22

View file

@ -1,3 +1,4 @@
// unit-test
// compile-flags: -O
static FOO: u8 = 2;

View file

@ -13,7 +13,7 @@
StorageLive(_2); // scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17
_4 = const main::promoted[0]; // scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17
// mir::Constant
// + span: $DIR/ref_deref_project.rs:5:6: 5:17
// + span: $DIR/ref_deref_project.rs:6:6: 6:17
// + literal: Const { ty: &(i32, i32), val: Unevaluated(main, [], Some(promoted[0])) }
_2 = &((*_4).1: i32); // scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17
_1 = (*_2); // scope 0 at $DIR/ref_deref_project.rs:+1:5: +1:17

View file

@ -16,7 +16,7 @@
- _2 = &(_3.1: i32); // scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17
+ _4 = const main::promoted[0]; // scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17
+ // mir::Constant
+ // + span: $DIR/ref_deref_project.rs:5:6: 5:17
+ // + span: $DIR/ref_deref_project.rs:6:6: 6:17
+ // + literal: Const { ty: &(i32, i32), val: Unevaluated(main, [], Some(promoted[0])) }
+ _2 = &((*_4).1: i32); // scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17
_1 = (*_2); // scope 0 at $DIR/ref_deref_project.rs:+1:5: +1:17

View file

@ -1,3 +1,4 @@
// unit-test
// EMIT_MIR ref_deref_project.main.PromoteTemps.diff
// EMIT_MIR ref_deref_project.main.ConstProp.diff