Skip to content

Commit

Permalink
Rollup merge of #99770 - Nilstrieb:mir-pass-unit-test, r=oli-obk
Browse files Browse the repository at this point in the history
Make some const prop mir-opt tests `unit-test`s

Most of these have no or only tiny diffs beyond line numbers being changed (would it make sense to not have line numbers in mir-opt tests?). Some things changed a bit, but I think it should all be fine, not sure though.
  • Loading branch information
Dylan-DPC authored Aug 22, 2022
2 parents 56ba13a + ee30cc8 commit e77c208
Show file tree
Hide file tree
Showing 42 changed files with 60 additions and 38 deletions.
2 changes: 1 addition & 1 deletion src/test/mir-opt/const_prop/aggregate.main.ConstProp.diff
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions src/test/mir-opt/const_prop/aggregate.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// unit-test: ConstProp
// compile-flags: -O

// EMIT_MIR aggregate.main.ConstProp.diff
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@
_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: {
- _1 = _2[_3]; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
+ _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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@
_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: {
- _1 = _2[_3]; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
+ _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
}
Expand Down
1 change: 1 addition & 0 deletions src/test/mir-opt/const_prop/array_index.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_BIT_WIDTH

// EMIT_MIR array_index.main.ConstProp.diff
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/test/mir-opt/const_prop/bad_op_div_by_zero.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// unit-test: ConstProp
// EMIT_MIR bad_op_div_by_zero.main.ConstProp.diff
#[allow(unconditional_panic)]
fn main() {
Expand Down
1 change: 1 addition & 0 deletions src/test/mir-opt/const_prop/boolean_identities.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// unit-test: ConstProp
// compile-flags: -O -Zmir-opt-level=4

// EMIT_MIR boolean_identities.test.ConstProp.diff
Expand Down
7 changes: 3 additions & 4 deletions src/test/mir-opt/const_prop/boxes.main.ConstProp.diff
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,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>) }
}

Expand All @@ -53,7 +52,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
}
Expand Down
1 change: 1 addition & 0 deletions src/test/mir-opt/const_prop/boxes.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// unit-test: ConstProp
// compile-flags: -O
// ignore-emscripten compiled with panic=abort by default
// ignore-wasm32
Expand Down
2 changes: 1 addition & 1 deletion src/test/mir-opt/const_prop/cast.main.ConstProp.diff
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/test/mir-opt/const_prop/cast.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// unit-test: ConstProp
// EMIT_MIR cast.main.ConstProp.diff

fn main() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions src/test/mir-opt/const_prop/checked_add.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// unit-test: ConstProp
// compile-flags: -C overflow-checks=on

// EMIT_MIR checked_add.main.ConstProp.diff
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions src/test/mir-opt/const_prop/const_prop_fails_gracefully.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// unit-test: ConstProp
#[inline(never)]
fn read(_: usize) { }

Expand Down
7 changes: 4 additions & 3 deletions src/test/mir-opt/const_prop/control-flow-simplification.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions src/test/mir-opt/const_prop/discriminant.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/test/mir-opt/const_prop/indirect.main.ConstProp.diff
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions src/test/mir-opt/const_prop/indirect.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// unit-test: ConstProp
// compile-flags: -C overflow-checks=on

// EMIT_MIR indirect.main.ConstProp.diff
Expand Down
1 change: 1 addition & 0 deletions src/test/mir-opt/const_prop/issue-66971.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions src/test/mir-opt/const_prop/issue-67019.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// unit-test: ConstProp
// compile-flags: -Z mir-opt-level=3

// This used to ICE in const-prop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>) }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>) }
}

Expand Down
1 change: 1 addition & 0 deletions src/test/mir-opt/const_prop/mult_by_zero.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// unit-test
// compile-flags: -O -Zmir-opt-level=4

// EMIT_MIR mult_by_zero.test.ConstProp.diff
Expand Down
1 change: 1 addition & 0 deletions src/test/mir-opt/const_prop/mutable_variable.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// unit-test
// compile-flags: -O

// EMIT_MIR mutable_variable.main.ConstProp.diff
Expand Down
1 change: 1 addition & 0 deletions src/test/mir-opt/const_prop/mutable_variable_aggregate.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// unit-test
// compile-flags: -O

// EMIT_MIR mutable_variable_aggregate.main.ConstProp.diff
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// unit-test
// compile-flags: -O

// EMIT_MIR mutable_variable_aggregate_mut_ref.main.ConstProp.diff
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>) }
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// unit-test
// compile-flags: -O

// EMIT_MIR mutable_variable_aggregate_partial_read.main.ConstProp.diff
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/test/mir-opt/const_prop/mutable_variable_no_prop.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// unit-test
// compile-flags: -O

static mut STATIC: u32 = 42;
Expand Down
Loading

0 comments on commit e77c208

Please sign in to comment.