Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 86cf461

Browse files
committedAug 20, 2020
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

0 commit comments

Comments
 (0)
Please sign in to comment.