@@ -428,10 +428,8 @@ impl FromWithTcx<clean::GenericBound> for GenericBound {
428428 use clean:: GenericBound :: * ;
429429 match bound {
430430 TraitBound ( clean:: PolyTrait { trait_, generic_params } , modifier) => {
431- // FIXME: should `trait_` be a clean::Path equivalent in JSON?
432- let trait_ = clean:: Type :: Path { path : trait_ } . into_tcx ( tcx) ;
433431 GenericBound :: TraitBound {
434- trait_,
432+ trait_ : trait_ . into_tcx ( tcx ) ,
435433 generic_params : generic_params. into_tcx ( tcx) ,
436434 modifier : from_trait_bound_modifier ( modifier) ,
437435 }
@@ -460,12 +458,7 @@ impl FromWithTcx<clean::Type> for Type {
460458 } ;
461459
462460 match ty {
463- clean:: Type :: Path { path } => Type :: ResolvedPath {
464- name : path. whole_name ( ) ,
465- id : from_item_id ( path. def_id ( ) . into ( ) , tcx) ,
466- args : path. segments . last ( ) . map ( |args| Box :: new ( args. clone ( ) . args . into_tcx ( tcx) ) ) ,
467- param_names : Vec :: new ( ) ,
468- } ,
461+ clean:: Type :: Path { path } => Type :: ResolvedPath ( path. into_tcx ( tcx) ) ,
469462 clean:: Type :: DynTrait ( bounds, lt) => Type :: DynTrait ( DynTrait {
470463 lifetime : lt. map ( convert_lifetime) ,
471464 traits : bounds. into_tcx ( tcx) ,
@@ -487,16 +480,22 @@ impl FromWithTcx<clean::Type> for Type {
487480 mutable : mutability == ast:: Mutability :: Mut ,
488481 type_ : Box :: new ( ( * type_) . into_tcx ( tcx) ) ,
489482 } ,
490- QPath { assoc, self_type, trait_, .. } => {
491- // FIXME: should `trait_` be a clean::Path equivalent in JSON?
492- let trait_ = clean:: Type :: Path { path : trait_ } . into_tcx ( tcx) ;
493- Type :: QualifiedPath {
494- name : assoc. name . to_string ( ) ,
495- args : Box :: new ( assoc. args . clone ( ) . into_tcx ( tcx) ) ,
496- self_type : Box :: new ( ( * self_type) . into_tcx ( tcx) ) ,
497- trait_ : Box :: new ( trait_) ,
498- }
499- }
483+ QPath { assoc, self_type, trait_, .. } => Type :: QualifiedPath {
484+ name : assoc. name . to_string ( ) ,
485+ args : Box :: new ( assoc. args . clone ( ) . into_tcx ( tcx) ) ,
486+ self_type : Box :: new ( ( * self_type) . into_tcx ( tcx) ) ,
487+ trait_ : trait_. into_tcx ( tcx) ,
488+ } ,
489+ }
490+ }
491+ }
492+
493+ impl FromWithTcx < clean:: Path > for Path {
494+ fn from_tcx ( path : clean:: Path , tcx : TyCtxt < ' _ > ) -> Path {
495+ Path {
496+ name : path. whole_name ( ) ,
497+ id : from_item_id ( path. def_id ( ) . into ( ) , tcx) ,
498+ args : path. segments . last ( ) . map ( |args| Box :: new ( args. clone ( ) . args . into_tcx ( tcx) ) ) ,
500499 }
501500 }
502501}
@@ -565,19 +564,14 @@ impl FromWithTcx<clean::PolyTrait> for PolyTrait {
565564 clean:: PolyTrait { trait_, generic_params } : clean:: PolyTrait ,
566565 tcx : TyCtxt < ' _ > ,
567566 ) -> Self {
568- PolyTrait {
569- trait_ : clean:: Type :: Path { path : trait_ } . into_tcx ( tcx) ,
570- generic_params : generic_params. into_tcx ( tcx) ,
571- }
567+ PolyTrait { trait_ : trait_. into_tcx ( tcx) , generic_params : generic_params. into_tcx ( tcx) }
572568 }
573569}
574570
575571impl FromWithTcx < clean:: Impl > for Impl {
576572 fn from_tcx ( impl_ : clean:: Impl , tcx : TyCtxt < ' _ > ) -> Self {
577573 let provided_trait_methods = impl_. provided_trait_methods ( tcx) ;
578574 let clean:: Impl { unsafety, generics, trait_, for_, items, polarity, kind } = impl_;
579- // FIXME: should `trait_` be a clean::Path equivalent in JSON?
580- let trait_ = trait_. map ( |path| clean:: Type :: Path { path } . into_tcx ( tcx) ) ;
581575 // FIXME: use something like ImplKind in JSON?
582576 let ( synthetic, blanket_impl) = match kind {
583577 clean:: ImplKind :: Normal | clean:: ImplKind :: FakeVaradic => ( false , None ) ,
@@ -595,7 +589,7 @@ impl FromWithTcx<clean::Impl> for Impl {
595589 . into_iter ( )
596590 . map ( |x| x. to_string ( ) )
597591 . collect ( ) ,
598- trait_,
592+ trait_ : trait_ . map ( |path| path . into_tcx ( tcx ) ) ,
599593 for_ : for_. into_tcx ( tcx) ,
600594 items : ids ( items, tcx) ,
601595 negative : negative_polarity,
0 commit comments