@@ -654,10 +654,7 @@ impl Clean<TyParamBound> for ty::BuiltinBound {
654654 ( tcx. lang_items . sync_trait ( ) . unwrap ( ) ,
655655 external_path ( cx, "Sync" , None , vec ! [ ] , & empty) ) ,
656656 } ;
657- let fqn = tcx. sess . cstore . item_path ( did) ;
658- let fqn = fqn. into_iter ( ) . map ( |i| i. to_string ( ) ) . collect ( ) ;
659- cx. external_paths . borrow_mut ( ) . as_mut ( ) . unwrap ( ) . insert ( did,
660- ( fqn, TypeTrait ) ) ;
657+ inline:: record_extern_fqn ( cx, did, TypeTrait ) ;
661658 TraitBound ( PolyTrait {
662659 trait_ : ResolvedPath {
663660 path : path,
@@ -676,13 +673,9 @@ impl<'tcx> Clean<TyParamBound> for ty::TraitRef<'tcx> {
676673 Some ( tcx) => tcx,
677674 None => return RegionBound ( Lifetime :: statik ( ) )
678675 } ;
679- let fqn = tcx. sess . cstore . item_path ( self . def_id ) ;
680- let fqn = fqn. into_iter ( ) . map ( |i| i. to_string ( ) )
681- . collect :: < Vec < String > > ( ) ;
682- let path = external_path ( cx, fqn. last ( ) . unwrap ( ) ,
676+ inline:: record_extern_fqn ( cx, self . def_id , TypeTrait ) ;
677+ let path = external_path ( cx, & tcx. item_name ( self . def_id ) . as_str ( ) ,
683678 Some ( self . def_id ) , vec ! [ ] , self . substs ) ;
684- cx. external_paths . borrow_mut ( ) . as_mut ( ) . unwrap ( ) . insert ( self . def_id ,
685- ( fqn, TypeTrait ) ) ;
686679
687680 debug ! ( "ty::TraitRef\n substs.types(TypeSpace): {:?}\n " ,
688681 self . substs. types. get_slice( ParamSpace :: TypeSpace ) ) ;
@@ -1663,15 +1656,13 @@ impl<'tcx> Clean<Type> for ty::Ty<'tcx> {
16631656 ty:: TyStruct ( def, substs) |
16641657 ty:: TyEnum ( def, substs) => {
16651658 let did = def. did ;
1666- let fqn = cx. tcx ( ) . sess . cstore . item_path ( did) ;
1667- let fqn: Vec < _ > = fqn. into_iter ( ) . map ( |i| i. to_string ( ) ) . collect ( ) ;
16681659 let kind = match self . sty {
16691660 ty:: TyStruct ( ..) => TypeStruct ,
16701661 _ => TypeEnum ,
16711662 } ;
1672- let path = external_path ( cx, & fqn. last ( ) . unwrap ( ) . to_string ( ) ,
1663+ inline:: record_extern_fqn ( cx, did, kind) ;
1664+ let path = external_path ( cx, & cx. tcx ( ) . item_name ( did) . as_str ( ) ,
16731665 None , vec ! [ ] , substs) ;
1674- cx. external_paths . borrow_mut ( ) . as_mut ( ) . unwrap ( ) . insert ( did, ( fqn, kind) ) ;
16751666 ResolvedPath {
16761667 path : path,
16771668 typarams : None ,
@@ -1681,12 +1672,10 @@ impl<'tcx> Clean<Type> for ty::Ty<'tcx> {
16811672 }
16821673 ty:: TyTrait ( box ty:: TraitTy { ref principal, ref bounds } ) => {
16831674 let did = principal. def_id ( ) ;
1684- let fqn = cx. tcx ( ) . sess . cstore . item_path ( did) ;
1685- let fqn: Vec < _ > = fqn. into_iter ( ) . map ( |i| i. to_string ( ) ) . collect ( ) ;
1675+ inline:: record_extern_fqn ( cx, did, TypeTrait ) ;
16861676 let ( typarams, bindings) = bounds. clean ( cx) ;
1687- let path = external_path ( cx, & fqn . last ( ) . unwrap ( ) . to_string ( ) ,
1677+ let path = external_path ( cx, & cx . tcx ( ) . item_name ( did ) . as_str ( ) ,
16881678 Some ( did) , bindings, principal. substs ( ) ) ;
1689- cx. external_paths . borrow_mut ( ) . as_mut ( ) . unwrap ( ) . insert ( did, ( fqn, TypeTrait ) ) ;
16901679 ResolvedPath {
16911680 path : path,
16921681 typarams : Some ( typarams) ,
@@ -2816,11 +2805,7 @@ fn lang_struct(cx: &DocContext, did: Option<DefId>,
28162805 Some ( did) => did,
28172806 None => return fallback ( box t. clean ( cx) ) ,
28182807 } ;
2819- let fqn = cx. tcx ( ) . sess . cstore . item_path ( did) ;
2820- let fqn: Vec < String > = fqn. into_iter ( ) . map ( |i| {
2821- i. to_string ( )
2822- } ) . collect ( ) ;
2823- cx. external_paths . borrow_mut ( ) . as_mut ( ) . unwrap ( ) . insert ( did, ( fqn, TypeStruct ) ) ;
2808+ inline:: record_extern_fqn ( cx, did, TypeStruct ) ;
28242809 ResolvedPath {
28252810 typarams : None ,
28262811 did : did,
0 commit comments