@@ -91,10 +91,10 @@ impl Res {
9191 }
9292 }
9393
94- fn name ( self , tcx : TyCtxt < ' _ > ) -> String {
94+ fn name ( self , tcx : TyCtxt < ' _ > ) -> Symbol {
9595 match self {
96- Res :: Def ( _, id) => tcx. item_name ( id) . to_string ( ) ,
97- Res :: Primitive ( prim) => prim. as_str ( ) . to_string ( ) ,
96+ Res :: Def ( _, id) => tcx. item_name ( id) ,
97+ Res :: Primitive ( prim) => prim. as_sym ( ) ,
9898 }
9999 }
100100
@@ -388,7 +388,7 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
388388 ty:: AssocKind :: Const => "associatedconstant" ,
389389 ty:: AssocKind :: Type => "associatedtype" ,
390390 } ;
391- let fragment = format ! ( "{}#{}.{}" , prim_ty. as_str ( ) , out, item_name) ;
391+ let fragment = format ! ( "{}#{}.{}" , prim_ty. as_sym ( ) , out, item_name) ;
392392 ( Res :: Primitive ( prim_ty) , fragment, Some ( ( kind. as_def_kind ( ) , item. def_id ) ) )
393393 } )
394394 } )
@@ -481,7 +481,7 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
481481 AnchorFailure :: RustdocAnchorConflict ( res) ,
482482 ) ) ;
483483 }
484- return Ok ( ( res, Some ( ty. as_str ( ) . to_owned ( ) ) ) ) ;
484+ return Ok ( ( res, Some ( ty. as_sym ( ) . to_string ( ) ) ) ) ;
485485 }
486486 _ => return Ok ( ( res, extra_fragment. clone ( ) ) ) ,
487487 }
@@ -1148,7 +1148,7 @@ impl LinkCollector<'_, '_> {
11481148 return None ;
11491149 }
11501150 res = prim;
1151- fragment = Some ( prim. name ( self . cx . tcx ) ) ;
1151+ fragment = Some ( prim. name ( self . cx . tcx ) . to_string ( ) ) ;
11521152 } else {
11531153 // `[char]` when a `char` module is in scope
11541154 let candidates = vec ! [ res, prim] ;
0 commit comments