@@ -387,20 +387,30 @@ impl Visitor<'tcx> for ExtraComments<'tcx> {
387
387
fn visit_constant ( & mut self , constant : & Constant < ' tcx > , location : Location ) {
388
388
self . super_constant ( constant, location) ;
389
389
let Constant { span, user_ty, literal } = constant;
390
- self . push ( "mir::Constant" ) ;
391
- self . push ( & format ! ( "+ span: {}" , self . tcx. sess. source_map( ) . span_to_string( * span) ) ) ;
392
- if let Some ( user_ty) = user_ty {
393
- self . push ( & format ! ( "+ user_ty: {:?}" , user_ty) ) ;
390
+ match literal. ty . kind {
391
+ ty:: Int ( _) | ty:: Uint ( _) | ty:: Bool | ty:: Char => { }
392
+ _ => {
393
+ self . push ( "mir::Constant" ) ;
394
+ self . push ( & format ! ( "+ span: {}" , self . tcx. sess. source_map( ) . span_to_string( * span) ) ) ;
395
+ if let Some ( user_ty) = user_ty {
396
+ self . push ( & format ! ( "+ user_ty: {:?}" , user_ty) ) ;
397
+ }
398
+ self . push ( & format ! ( "+ literal: {:?}" , literal) ) ;
399
+ }
394
400
}
395
- self . push ( & format ! ( "+ literal: {:?}" , literal) ) ;
396
401
}
397
402
398
403
fn visit_const ( & mut self , constant : & & ' tcx ty:: Const < ' tcx > , _: Location ) {
399
404
self . super_const ( constant) ;
400
405
let ty:: Const { ty, val, .. } = constant;
401
- self . push ( "ty::Const" ) ;
402
- self . push ( & format ! ( "+ ty: {:?}" , ty) ) ;
403
- self . push ( & format ! ( "+ val: {:?}" , val) ) ;
406
+ match ty. kind {
407
+ ty:: Int ( _) | ty:: Uint ( _) | ty:: Bool | ty:: Char => { }
408
+ _ => {
409
+ self . push ( "ty::Const" ) ;
410
+ self . push ( & format ! ( "+ ty: {:?}" , ty) ) ;
411
+ self . push ( & format ! ( "+ val: {:?}" , val) ) ;
412
+ }
413
+ }
404
414
}
405
415
406
416
fn visit_rvalue ( & mut self , rvalue : & Rvalue < ' tcx > , location : Location ) {
0 commit comments