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

src/librustc_mir/util/pretty.rs

Lines changed: 4 additions & 0 deletions
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");

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

Lines changed: 0 additions & 6 deletions
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

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

Lines changed: 0 additions & 6 deletions
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

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

Lines changed: 0 additions & 6 deletions
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

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

Lines changed: 0 additions & 6 deletions
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

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

Lines changed: 0 additions & 6 deletions
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

src/test/mir-opt/box_expr.main.ElaborateDrops.before.mir

Lines changed: 0 additions & 6 deletions
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

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

Lines changed: 0 additions & 6 deletions
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

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

Lines changed: 0 additions & 6 deletions
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
}

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

Lines changed: 0 additions & 6 deletions
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
}

0 commit comments

Comments
 (0)