@@ -222,8 +222,8 @@ impl<'tcx> ty::TyS<'tcx> {
222
222
pub fn sort_string ( & self , tcx : TyCtxt < ' _ > ) -> Cow < ' static , str > {
223
223
match self . kind {
224
224
ty:: Bool | ty:: Char | ty:: Int ( _) |
225
- ty:: Uint ( _) | ty:: Float ( _) | ty:: Str | ty:: Never => format ! ( "{} " , self ) . into ( ) ,
226
- ty:: Tuple ( ref tys) if tys. is_empty ( ) => format ! ( "{} " , self ) . into ( ) ,
225
+ ty:: Uint ( _) | ty:: Float ( _) | ty:: Str | ty:: Never => format ! ( "`{}` " , self ) . into ( ) ,
226
+ ty:: Tuple ( ref tys) if tys. is_empty ( ) => format ! ( "`{}` " , self ) . into ( ) ,
227
227
228
228
ty:: Adt ( def, _) => format ! ( "{} `{}`" , def. descr( ) , tcx. def_path_str( def. did) ) . into ( ) ,
229
229
ty:: Foreign ( def_id) => format ! ( "extern type `{}`" , tcx. def_path_str( def_id) ) . into ( ) ,
@@ -244,7 +244,7 @@ impl<'tcx> ty::TyS<'tcx> {
244
244
if tymut_string != "_" && (
245
245
ty. is_simple_text ( ) || tymut_string. len ( ) < "mutable reference" . len ( )
246
246
) {
247
- format ! ( "&{}" , tymut_string) . into ( )
247
+ format ! ( "` &{}` " , tymut_string) . into ( )
248
248
} else { // Unknown type name, it's long or has type arguments
249
249
match mutbl {
250
250
hir:: Mutability :: Mutable => "mutable reference" ,
@@ -256,7 +256,7 @@ impl<'tcx> ty::TyS<'tcx> {
256
256
ty:: FnPtr ( _) => "fn pointer" . into ( ) ,
257
257
ty:: Dynamic ( ref inner, ..) => {
258
258
if let Some ( principal) = inner. principal ( ) {
259
- format ! ( "trait {} " , tcx. def_path_str( principal. def_id( ) ) ) . into ( )
259
+ format ! ( "trait `{}` " , tcx. def_path_str( principal. def_id( ) ) ) . into ( )
260
260
} else {
261
261
"trait" . into ( )
262
262
}
0 commit comments