@@ -466,9 +466,9 @@ pub trait PrettyPrinter<'tcx>:
466
466
match ty. kind {
467
467
ty:: Bool => p ! ( write( "bool" ) ) ,
468
468
ty:: Char => p ! ( write( "char" ) ) ,
469
- ty:: Int ( t) => p ! ( write( "{}" , t. ty_to_string ( ) ) ) ,
470
- ty:: Uint ( t) => p ! ( write( "{}" , t. ty_to_string ( ) ) ) ,
471
- ty:: Float ( t) => p ! ( write( "{}" , t. ty_to_string ( ) ) ) ,
469
+ ty:: Int ( t) => p ! ( write( "{}" , t. name_str ( ) ) ) ,
470
+ ty:: Uint ( t) => p ! ( write( "{}" , t. name_str ( ) ) ) ,
471
+ ty:: Float ( t) => p ! ( write( "{}" , t. name_str ( ) ) ) ,
472
472
ty:: RawPtr ( ref tm) => {
473
473
p ! ( write( "*{} " , match tm. mutbl {
474
474
hir:: MutMutable => "mut" ,
@@ -895,10 +895,11 @@ pub trait PrettyPrinter<'tcx>:
895
895
let bit_size = Integer :: from_attr ( & self . tcx ( ) , UnsignedInt ( * ui) ) . size ( ) ;
896
896
let max = truncate ( u128:: max_value ( ) , bit_size) ;
897
897
898
+ let ui_str = ui. name_str ( ) ;
898
899
if data == max {
899
- p ! ( write( "std::{}::MAX" , ui ) )
900
+ p ! ( write( "std::{}::MAX" , ui_str ) )
900
901
} else {
901
- p ! ( write( "{}{}" , data, ui ) )
902
+ p ! ( write( "{}{}" , data, ui_str ) )
902
903
} ;
903
904
} ,
904
905
( ConstValue :: Scalar ( Scalar :: Raw { data, .. } ) , ty:: Int ( i) ) => {
@@ -911,10 +912,11 @@ pub trait PrettyPrinter<'tcx>:
911
912
let size = self . tcx ( ) . layout_of ( ty:: ParamEnv :: empty ( ) . and ( ty) )
912
913
. unwrap ( )
913
914
. size ;
915
+ let i_str = i. name_str ( ) ;
914
916
match data {
915
- d if d == min => p ! ( write( "std::{}::MIN" , i ) ) ,
916
- d if d == max => p ! ( write( "std::{}::MAX" , i ) ) ,
917
- _ => p ! ( write( "{}{}" , sign_extend( data, size) as i128 , i ) )
917
+ d if d == min => p ! ( write( "std::{}::MIN" , i_str ) ) ,
918
+ d if d == max => p ! ( write( "std::{}::MAX" , i_str ) ) ,
919
+ _ => p ! ( write( "{}{}" , sign_extend( data, size) as i128 , i_str ) )
918
920
}
919
921
} ,
920
922
( ConstValue :: Scalar ( Scalar :: Raw { data, .. } ) , ty:: Char ) =>
@@ -1666,8 +1668,7 @@ define_print_and_forward_display! {
1666
1668
}
1667
1669
1668
1670
ty:: TypeAndMut <' tcx> {
1669
- p!( write( "{}" , if self . mutbl == hir:: MutMutable { "mut " } else { "" } ) ,
1670
- print( self . ty) )
1671
+ p!( write( "{}" , self . mutbl. prefix_str( ) ) , print( self . ty) )
1671
1672
}
1672
1673
1673
1674
ty:: ExistentialTraitRef <' tcx> {
@@ -1693,9 +1694,7 @@ define_print_and_forward_display! {
1693
1694
}
1694
1695
1695
1696
ty:: FnSig <' tcx> {
1696
- if self . unsafety == hir:: Unsafety :: Unsafe {
1697
- p!( write( "unsafe " ) ) ;
1698
- }
1697
+ p!( write( "{}" , self . unsafety. prefix_str( ) ) ) ;
1699
1698
1700
1699
if self . abi != Abi :: Rust {
1701
1700
p!( write( "extern {} " , self . abi) ) ;
0 commit comments