Skip to content

Commit 86cf461

Browse files
committed
Suppress MIR comments of Unit type
1 parent f6bd213 commit 86cf461

File tree

116 files changed

+43
-985
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+43
-985
lines changed

Diff for: src/librustc_mir/util/pretty.rs

+4
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,8 @@ impl Visitor<'tcx> for ExtraComments<'tcx> {
389389
let Constant { span, user_ty, literal } = constant;
390390
match literal.ty.kind {
391391
ty::Int(_) | ty::Uint(_) | ty::Bool | ty::Char => {}
392+
// Unit type
393+
ty::Tuple(tys) if tys.is_empty() => {}
392394
_ => {
393395
self.push("mir::Constant");
394396
self.push(&format!("+ span: {}", self.tcx.sess.source_map().span_to_string(*span)));
@@ -405,6 +407,8 @@ impl Visitor<'tcx> for ExtraComments<'tcx> {
405407
let ty::Const { ty, val, .. } = constant;
406408
match ty.kind {
407409
ty::Int(_) | ty::Uint(_) | ty::Bool | ty::Char => {}
410+
// Unit type
411+
ty::Tuple(tys) if tys.is_empty() => {}
408412
ty::FnDef(..) => {}
409413
_ => {
410414
self.push("ty::Const");

Diff for: src/test/mir-opt/address_of.address_of_reborrow.SimplifyCfg-initial.after.mir

-6
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,6 @@ fn address_of_reborrow() -> () {
287287
FakeRead(ForLet, _47); // scope 13 at $DIR/address-of.rs:36:9: 36:10
288288
AscribeUserType(_47, o, UserTypeProjection { base: UserType(29), projs: [] }); // scope 13 at $DIR/address-of.rs:36:12: 36:22
289289
_0 = const (); // scope 0 at $DIR/address-of.rs:3:26: 37:2
290-
// ty::Const
291-
// + ty: ()
292-
// + val: Value(Scalar(<ZST>))
293-
// mir::Constant
294-
// + span: $DIR/address-of.rs:3:26: 37:2
295-
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
296290
StorageDead(_47); // scope 13 at $DIR/address-of.rs:37:1: 37:2
297291
StorageDead(_45); // scope 12 at $DIR/address-of.rs:37:1: 37:2
298292
StorageDead(_44); // scope 11 at $DIR/address-of.rs:37:1: 37:2

Diff for: src/test/mir-opt/address_of.borrow_and_cast.SimplifyCfg-initial.after.mir

-6
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,6 @@ fn borrow_and_cast(_1: i32) -> () {
3939
FakeRead(ForLet, _6); // scope 2 at $DIR/address-of.rs:44:9: 44:10
4040
StorageDead(_7); // scope 2 at $DIR/address-of.rs:44:31: 44:32
4141
_0 = const (); // scope 0 at $DIR/address-of.rs:41:32: 45:2
42-
// ty::Const
43-
// + ty: ()
44-
// + val: Value(Scalar(<ZST>))
45-
// mir::Constant
46-
// + span: $DIR/address-of.rs:41:32: 45:2
47-
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
4842
StorageDead(_6); // scope 2 at $DIR/address-of.rs:45:1: 45:2
4943
StorageDead(_4); // scope 1 at $DIR/address-of.rs:45:1: 45:2
5044
StorageDead(_2); // scope 0 at $DIR/address-of.rs:45:1: 45:2

Diff for: src/test/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir.32bit

-6
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,6 @@ fn main() -> () {
5656
StorageDead(_5); // scope 3 at $DIR/array-index-is-temporary.rs:16:28: 16:29
5757
StorageDead(_7); // scope 3 at $DIR/array-index-is-temporary.rs:16:29: 16:30
5858
_0 = const (); // scope 0 at $DIR/array-index-is-temporary.rs:12:11: 17:2
59-
// ty::Const
60-
// + ty: ()
61-
// + val: Value(Scalar(<ZST>))
62-
// mir::Constant
63-
// + span: $DIR/array-index-is-temporary.rs:12:11: 17:2
64-
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
6559
StorageDead(_3); // scope 2 at $DIR/array-index-is-temporary.rs:17:1: 17:2
6660
StorageDead(_2); // scope 1 at $DIR/array-index-is-temporary.rs:17:1: 17:2
6761
StorageDead(_1); // scope 0 at $DIR/array-index-is-temporary.rs:17:1: 17:2

Diff for: src/test/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir.64bit

-6
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,6 @@ fn main() -> () {
5656
StorageDead(_5); // scope 3 at $DIR/array-index-is-temporary.rs:16:28: 16:29
5757
StorageDead(_7); // scope 3 at $DIR/array-index-is-temporary.rs:16:29: 16:30
5858
_0 = const (); // scope 0 at $DIR/array-index-is-temporary.rs:12:11: 17:2
59-
// ty::Const
60-
// + ty: ()
61-
// + val: Value(Scalar(<ZST>))
62-
// mir::Constant
63-
// + span: $DIR/array-index-is-temporary.rs:12:11: 17:2
64-
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
6559
StorageDead(_3); // scope 2 at $DIR/array-index-is-temporary.rs:17:1: 17:2
6660
StorageDead(_2); // scope 1 at $DIR/array-index-is-temporary.rs:17:1: 17:2
6761
StorageDead(_1); // scope 0 at $DIR/array-index-is-temporary.rs:17:1: 17:2

Diff for: src/test/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir

-6
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,6 @@ fn main() -> () {
6767
bb6: {
6868
StorageDead(_6); // scope 4 at $DIR/basic_assignment.rs:23:19: 23:20
6969
_0 = const (); // scope 0 at $DIR/basic_assignment.rs:10:11: 24:2
70-
// ty::Const
71-
// + ty: ()
72-
// + val: Value(Scalar(<ZST>))
73-
// mir::Constant
74-
// + span: $DIR/basic_assignment.rs:10:11: 24:2
75-
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
7670
drop(_5) -> [return: bb7, unwind: bb3]; // scope 3 at $DIR/basic_assignment.rs:24:1: 24:2
7771
}
7872

Diff for: src/test/mir-opt/box_expr.main.ElaborateDrops.before.mir

-6
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@ fn main() -> () {
4848
StorageDead(_4); // scope 1 at $DIR/box_expr.rs:8:11: 8:12
4949
StorageDead(_3); // scope 1 at $DIR/box_expr.rs:8:12: 8:13
5050
_0 = const (); // scope 0 at $DIR/box_expr.rs:6:11: 9:2
51-
// ty::Const
52-
// + ty: ()
53-
// + val: Value(Scalar(<ZST>))
54-
// mir::Constant
55-
// + span: $DIR/box_expr.rs:6:11: 9:2
56-
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
5751
drop(_1) -> bb8; // scope 0 at $DIR/box_expr.rs:9:1: 9:2
5852
}
5953

Diff for: src/test/mir-opt/byte_slice.main.SimplifyCfg-elaborate-drops.after.mir

-6
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ fn main() -> () {
2323
StorageLive(_2); // scope 1 at $DIR/byte_slice.rs:6:9: 6:10
2424
_2 = [const 5_u8, const 120_u8]; // scope 1 at $DIR/byte_slice.rs:6:13: 6:24
2525
_0 = const (); // scope 0 at $DIR/byte_slice.rs:4:11: 7:2
26-
// ty::Const
27-
// + ty: ()
28-
// + val: Value(Scalar(<ZST>))
29-
// mir::Constant
30-
// + span: $DIR/byte_slice.rs:4:11: 7:2
31-
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
3226
StorageDead(_2); // scope 1 at $DIR/byte_slice.rs:7:1: 7:2
3327
StorageDead(_1); // scope 0 at $DIR/byte_slice.rs:7:1: 7:2
3428
return; // scope 0 at $DIR/byte_slice.rs:7:2: 7:2

Diff for: src/test/mir-opt/const_allocation.main.ConstProp.after.mir.32bit

-6
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ fn main() -> () {
1919
StorageDead(_2); // scope 0 at $DIR/const_allocation.rs:8:8: 8:9
2020
StorageDead(_1); // scope 0 at $DIR/const_allocation.rs:8:8: 8:9
2121
_0 = const (); // scope 0 at $DIR/const_allocation.rs:7:11: 9:2
22-
// ty::Const
23-
// + ty: ()
24-
// + val: Value(Scalar(<ZST>))
25-
// mir::Constant
26-
// + span: $DIR/const_allocation.rs:7:11: 9:2
27-
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
2822
return; // scope 0 at $DIR/const_allocation.rs:9:2: 9:2
2923
}
3024
}

Diff for: src/test/mir-opt/const_allocation.main.ConstProp.after.mir.64bit

-6
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ fn main() -> () {
1919
StorageDead(_2); // scope 0 at $DIR/const_allocation.rs:8:8: 8:9
2020
StorageDead(_1); // scope 0 at $DIR/const_allocation.rs:8:8: 8:9
2121
_0 = const (); // scope 0 at $DIR/const_allocation.rs:7:11: 9:2
22-
// ty::Const
23-
// + ty: ()
24-
// + val: Value(Scalar(<ZST>))
25-
// mir::Constant
26-
// + span: $DIR/const_allocation.rs:7:11: 9:2
27-
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
2822
return; // scope 0 at $DIR/const_allocation.rs:9:2: 9:2
2923
}
3024
}

Diff for: src/test/mir-opt/const_allocation2.main.ConstProp.after.mir.32bit

-6
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ fn main() -> () {
1919
StorageDead(_2); // scope 0 at $DIR/const_allocation2.rs:5:8: 5:9
2020
StorageDead(_1); // scope 0 at $DIR/const_allocation2.rs:5:8: 5:9
2121
_0 = const (); // scope 0 at $DIR/const_allocation2.rs:4:11: 6:2
22-
// ty::Const
23-
// + ty: ()
24-
// + val: Value(Scalar(<ZST>))
25-
// mir::Constant
26-
// + span: $DIR/const_allocation2.rs:4:11: 6:2
27-
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
2822
return; // scope 0 at $DIR/const_allocation2.rs:6:2: 6:2
2923
}
3024
}

Diff for: src/test/mir-opt/const_allocation2.main.ConstProp.after.mir.64bit

-6
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ fn main() -> () {
1919
StorageDead(_2); // scope 0 at $DIR/const_allocation2.rs:5:8: 5:9
2020
StorageDead(_1); // scope 0 at $DIR/const_allocation2.rs:5:8: 5:9
2121
_0 = const (); // scope 0 at $DIR/const_allocation2.rs:4:11: 6:2
22-
// ty::Const
23-
// + ty: ()
24-
// + val: Value(Scalar(<ZST>))
25-
// mir::Constant
26-
// + span: $DIR/const_allocation2.rs:4:11: 6:2
27-
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
2822
return; // scope 0 at $DIR/const_allocation2.rs:6:2: 6:2
2923
}
3024
}

Diff for: src/test/mir-opt/const_allocation3.main.ConstProp.after.mir.32bit

-6
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ fn main() -> () {
1919
StorageDead(_2); // scope 0 at $DIR/const_allocation3.rs:5:8: 5:9
2020
StorageDead(_1); // scope 0 at $DIR/const_allocation3.rs:5:8: 5:9
2121
_0 = const (); // scope 0 at $DIR/const_allocation3.rs:4:11: 6:2
22-
// ty::Const
23-
// + ty: ()
24-
// + val: Value(Scalar(<ZST>))
25-
// mir::Constant
26-
// + span: $DIR/const_allocation3.rs:4:11: 6:2
27-
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
2822
return; // scope 0 at $DIR/const_allocation3.rs:6:2: 6:2
2923
}
3024
}

Diff for: src/test/mir-opt/const_allocation3.main.ConstProp.after.mir.64bit

-6
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ fn main() -> () {
1919
StorageDead(_2); // scope 0 at $DIR/const_allocation3.rs:5:8: 5:9
2020
StorageDead(_1); // scope 0 at $DIR/const_allocation3.rs:5:8: 5:9
2121
_0 = const (); // scope 0 at $DIR/const_allocation3.rs:4:11: 6:2
22-
// ty::Const
23-
// + ty: ()
24-
// + val: Value(Scalar(<ZST>))
25-
// mir::Constant
26-
// + span: $DIR/const_allocation3.rs:4:11: 6:2
27-
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
2822
return; // scope 0 at $DIR/const_allocation3.rs:6:2: 6:2
2923
}
3024
}

Diff for: src/test/mir-opt/const_prop/aggregate.main.ConstProp.diff

-6
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@
2424
StorageDead(_2); // scope 0 at $DIR/aggregate.rs:5:27: 5:28
2525
StorageDead(_3); // scope 0 at $DIR/aggregate.rs:5:28: 5:29
2626
_0 = const (); // scope 0 at $DIR/aggregate.rs:4:11: 6:2
27-
// ty::Const
28-
// + ty: ()
29-
// + val: Value(Scalar(<ZST>))
30-
// mir::Constant
31-
// + span: $DIR/aggregate.rs:4:11: 6:2
32-
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
3327
StorageDead(_1); // scope 0 at $DIR/aggregate.rs:6:1: 6:2
3428
return; // scope 0 at $DIR/aggregate.rs:6:2: 6:2
3529
}

Diff for: src/test/mir-opt/const_prop/array_index.main.ConstProp.diff.32bit

-6
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@
3131
StorageDead(_3); // scope 0 at $DIR/array_index.rs:5:33: 5:34
3232
StorageDead(_2); // scope 0 at $DIR/array_index.rs:5:33: 5:34
3333
_0 = const (); // scope 0 at $DIR/array_index.rs:4:11: 6:2
34-
// ty::Const
35-
// + ty: ()
36-
// + val: Value(Scalar(<ZST>))
37-
// mir::Constant
38-
// + span: $DIR/array_index.rs:4:11: 6:2
39-
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
4034
StorageDead(_1); // scope 0 at $DIR/array_index.rs:6:1: 6:2
4135
return; // scope 0 at $DIR/array_index.rs:6:2: 6:2
4236
}

Diff for: src/test/mir-opt/const_prop/array_index.main.ConstProp.diff.64bit

-6
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@
3131
StorageDead(_3); // scope 0 at $DIR/array_index.rs:5:33: 5:34
3232
StorageDead(_2); // scope 0 at $DIR/array_index.rs:5:33: 5:34
3333
_0 = const (); // scope 0 at $DIR/array_index.rs:4:11: 6:2
34-
// ty::Const
35-
// + ty: ()
36-
// + val: Value(Scalar(<ZST>))
37-
// mir::Constant
38-
// + span: $DIR/array_index.rs:4:11: 6:2
39-
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
4034
StorageDead(_1); // scope 0 at $DIR/array_index.rs:6:1: 6:2
4135
return; // scope 0 at $DIR/array_index.rs:6:2: 6:2
4236
}

Diff for: src/test/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.diff

-6
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@
4646
+ _2 = Div(const 1_i32, const 0_i32); // scope 1 at $DIR/bad_op_div_by_zero.rs:5:14: 5:19
4747
StorageDead(_3); // scope 1 at $DIR/bad_op_div_by_zero.rs:5:18: 5:19
4848
_0 = const (); // scope 0 at $DIR/bad_op_div_by_zero.rs:3:11: 6:2
49-
// ty::Const
50-
// + ty: ()
51-
// + val: Value(Scalar(<ZST>))
52-
// mir::Constant
53-
// + span: $DIR/bad_op_div_by_zero.rs:3:11: 6:2
54-
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
5549
StorageDead(_2); // scope 1 at $DIR/bad_op_div_by_zero.rs:6:1: 6:2
5650
StorageDead(_1); // scope 0 at $DIR/bad_op_div_by_zero.rs:6:1: 6:2
5751
return; // scope 0 at $DIR/bad_op_div_by_zero.rs:6:2: 6:2

Diff for: src/test/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.diff

-6
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@
4646
+ _2 = Rem(const 1_i32, const 0_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
4747
StorageDead(_3); // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:18: 5:19
4848
_0 = const (); // scope 0 at $DIR/bad_op_mod_by_zero.rs:3:11: 6:2
49-
// ty::Const
50-
// + ty: ()
51-
// + val: Value(Scalar(<ZST>))
52-
// mir::Constant
53-
// + span: $DIR/bad_op_mod_by_zero.rs:3:11: 6:2
54-
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
5549
StorageDead(_2); // scope 1 at $DIR/bad_op_mod_by_zero.rs:6:1: 6:2
5650
StorageDead(_1); // scope 0 at $DIR/bad_op_mod_by_zero.rs:6:1: 6:2
5751
return; // scope 0 at $DIR/bad_op_mod_by_zero.rs:6:2: 6:2

Diff for: src/test/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.diff.32bit

-6
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,6 @@
5151
_5 = (*_1)[_6]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:7:18: 7:25
5252
StorageDead(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:7:25: 7:26
5353
_0 = const (); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:6:5: 8:6
54-
// ty::Const
55-
// + ty: ()
56-
// + val: Value(Scalar(<ZST>))
57-
// mir::Constant
58-
// + span: $DIR/bad_op_unsafe_oob_for_slices.rs:6:5: 8:6
59-
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
6054
StorageDead(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:8:5: 8:6
6155
StorageDead(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:9:1: 9:2
6256
return; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:9:2: 9:2

Diff for: src/test/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.diff.64bit

-6
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,6 @@
5151
_5 = (*_1)[_6]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:7:18: 7:25
5252
StorageDead(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:7:25: 7:26
5353
_0 = const (); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:6:5: 8:6
54-
// ty::Const
55-
// + ty: ()
56-
// + val: Value(Scalar(<ZST>))
57-
// mir::Constant
58-
// + span: $DIR/bad_op_unsafe_oob_for_slices.rs:6:5: 8:6
59-
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
6054
StorageDead(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:8:5: 8:6
6155
StorageDead(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:9:1: 9:2
6256
return; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:9:2: 9:2

Diff for: src/test/mir-opt/const_prop/boxes.main.ConstProp.diff

-6
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@
3333
bb2: {
3434
StorageDead(_3); // scope 0 at $DIR/boxes.rs:12:26: 12:27
3535
_0 = const (); // scope 0 at $DIR/boxes.rs:11:11: 13:2
36-
// ty::Const
37-
// + ty: ()
38-
// + val: Value(Scalar(<ZST>))
39-
// mir::Constant
40-
// + span: $DIR/boxes.rs:11:11: 13:2
41-
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
4236
StorageDead(_1); // scope 0 at $DIR/boxes.rs:13:1: 13:2
4337
return; // scope 0 at $DIR/boxes.rs:13:2: 13:2
4438
}

0 commit comments

Comments
 (0)