@@ -180,7 +180,7 @@ impl Clean<Type> for (ty::TraitRef<'_>, &[TypeBinding]) {
180180
181181 debug ! ( "ty::TraitRef\n subst: {:?}\n " , trait_ref. substs) ;
182182
183- ResolvedPath { path, param_names : None , did : trait_ref. def_id , is_generic : false }
183+ ResolvedPath { path, did : trait_ref. def_id , is_generic : false }
184184 }
185185}
186186
@@ -330,6 +330,7 @@ impl Clean<WherePredicate> for hir::WherePredicate<'_> {
330330 hir:: WherePredicate :: BoundPredicate ( ref wbp) => WherePredicate :: BoundPredicate {
331331 ty : wbp. bounded_ty . clean ( cx) ,
332332 bounds : wbp. bounds . clean ( cx) ,
333+ bound_params : wbp. bound_generic_params . into_iter ( ) . map ( |x| x. clean ( cx) ) . collect ( ) ,
333334 } ,
334335
335336 hir:: WherePredicate :: RegionPredicate ( ref wrp) => WherePredicate :: RegionPredicate {
@@ -370,6 +371,7 @@ impl<'a> Clean<WherePredicate> for ty::PolyTraitPredicate<'a> {
370371 WherePredicate :: BoundPredicate {
371372 ty : poly_trait_ref. skip_binder ( ) . self_ty ( ) . clean ( cx) ,
372373 bounds : vec ! [ poly_trait_ref. clean( cx) ] ,
374+ bound_params : Vec :: new ( ) ,
373375 }
374376 }
375377}
@@ -402,6 +404,7 @@ impl<'tcx> Clean<Option<WherePredicate>> for ty::OutlivesPredicate<Ty<'tcx>, ty:
402404 Some ( WherePredicate :: BoundPredicate {
403405 ty : ty. clean ( cx) ,
404406 bounds : vec ! [ GenericBound :: Outlives ( lt. clean( cx) . expect( "failed to clean lifetimes" ) ) ] ,
407+ bound_params : Vec :: new ( ) ,
405408 } )
406409 }
407410}
@@ -567,7 +570,9 @@ impl Clean<Generics> for hir::Generics<'_> {
567570 // to where predicates when such cases occur.
568571 for where_pred in & mut generics. where_predicates {
569572 match * where_pred {
570- WherePredicate :: BoundPredicate { ty : Generic ( ref name) , ref mut bounds } => {
573+ WherePredicate :: BoundPredicate {
574+ ty : Generic ( ref name) , ref mut bounds, ..
575+ } => {
571576 if bounds. is_empty ( ) {
572577 for param in & mut generics. params {
573578 match param. kind {
@@ -721,7 +726,7 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics, ty::GenericPredicates<'tcx
721726 // handled in cleaning associated types
722727 let mut sized_params = FxHashSet :: default ( ) ;
723728 where_predicates. retain ( |pred| match * pred {
724- WP :: BoundPredicate { ty : Generic ( ref g) , ref bounds } => {
729+ WP :: BoundPredicate { ty : Generic ( ref g) , ref bounds, .. } => {
725730 if bounds. iter ( ) . any ( |b| b. is_sized_bound ( cx) ) {
726731 sized_params. insert ( * g) ;
727732 false
@@ -741,6 +746,7 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics, ty::GenericPredicates<'tcx
741746 where_predicates. push ( WP :: BoundPredicate {
742747 ty : Type :: Generic ( tp. name ) ,
743748 bounds : vec ! [ GenericBound :: maybe_sized( cx) ] ,
749+ bound_params : Vec :: new ( ) ,
744750 } )
745751 }
746752 }
@@ -1117,6 +1123,7 @@ impl Clean<Item> for ty::AssocItem {
11171123 WherePredicate :: BoundPredicate {
11181124 ty : QPath { ref name, ref self_type, ref trait_, .. } ,
11191125 ref bounds,
1126+ ..
11201127 } => ( name, self_type, trait_, bounds) ,
11211128 _ => return None ,
11221129 } ;
@@ -1371,24 +1378,9 @@ impl Clean<Type> for hir::Ty<'_> {
13711378 }
13721379 TyKind :: Path ( _) => clean_qpath ( & self , cx) ,
13731380 TyKind :: TraitObject ( ref bounds, ref lifetime, _) => {
1374- match bounds[ 0 ] . clean ( cx) . trait_ {
1375- ResolvedPath { path, param_names : None , did, is_generic } => {
1376- let mut bounds: Vec < self :: GenericBound > = bounds[ 1 ..]
1377- . iter ( )
1378- . map ( |bound| {
1379- self :: GenericBound :: TraitBound (
1380- bound. clean ( cx) ,
1381- hir:: TraitBoundModifier :: None ,
1382- )
1383- } )
1384- . collect ( ) ;
1385- if !lifetime. is_elided ( ) {
1386- bounds. push ( self :: GenericBound :: Outlives ( lifetime. clean ( cx) ) ) ;
1387- }
1388- ResolvedPath { path, param_names : Some ( bounds) , did, is_generic }
1389- }
1390- _ => Infer , // shouldn't happen
1391- }
1381+ let bounds = bounds. iter ( ) . map ( |bound| bound. clean ( cx) ) . collect ( ) ;
1382+ let lifetime = if !lifetime. is_elided ( ) { Some ( lifetime. clean ( cx) ) } else { None } ;
1383+ DynTrait ( bounds, lifetime)
13921384 }
13931385 TyKind :: BareFn ( ref barefn) => BareFunction ( box barefn. clean ( cx) ) ,
13941386 TyKind :: Infer | TyKind :: Err => Infer ,
@@ -1471,7 +1463,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
14711463 } ;
14721464 inline:: record_extern_fqn ( cx, did, kind) ;
14731465 let path = external_path ( cx, cx. tcx . item_name ( did) , None , false , vec ! [ ] , substs) ;
1474- ResolvedPath { path, param_names : None , did, is_generic : false }
1466+ ResolvedPath { path, did, is_generic : false }
14751467 }
14761468 ty:: Foreign ( did) => {
14771469 inline:: record_extern_fqn ( cx, did, ItemType :: ForeignType ) ;
@@ -1483,7 +1475,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
14831475 vec ! [ ] ,
14841476 InternalSubsts :: empty ( ) ,
14851477 ) ;
1486- ResolvedPath { path, param_names : None , did, is_generic : false }
1478+ ResolvedPath { path, did, is_generic : false }
14871479 }
14881480 ty:: Dynamic ( ref obj, ref reg) => {
14891481 // HACK: pick the first `did` as the `did` of the trait object. Someone
@@ -1501,28 +1493,19 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
15011493
15021494 inline:: record_extern_fqn ( cx, did, ItemType :: Trait ) ;
15031495
1504- let mut param_names = vec ! [ ] ;
1505- if let Some ( b) = reg. clean ( cx) {
1506- param_names. push ( GenericBound :: Outlives ( b) ) ;
1507- }
1496+ let lifetime = reg. clean ( cx) ;
1497+ let mut bounds = vec ! [ ] ;
1498+
15081499 for did in dids {
15091500 let empty = cx. tcx . intern_substs ( & [ ] ) ;
15101501 let path =
15111502 external_path ( cx, cx. tcx . item_name ( did) , Some ( did) , false , vec ! [ ] , empty) ;
15121503 inline:: record_extern_fqn ( cx, did, ItemType :: Trait ) ;
1513- let bound = GenericBound :: TraitBound (
1514- PolyTrait {
1515- trait_ : ResolvedPath {
1516- path,
1517- param_names : None ,
1518- did,
1519- is_generic : false ,
1520- } ,
1521- generic_params : Vec :: new ( ) ,
1522- } ,
1523- hir:: TraitBoundModifier :: None ,
1524- ) ;
1525- param_names. push ( bound) ;
1504+ let bound = PolyTrait {
1505+ trait_ : ResolvedPath { path, did, is_generic : false } ,
1506+ generic_params : Vec :: new ( ) ,
1507+ } ;
1508+ bounds. push ( bound) ;
15261509 }
15271510
15281511 let mut bindings = vec ! [ ] ;
@@ -1535,7 +1518,15 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
15351518
15361519 let path =
15371520 external_path ( cx, cx. tcx . item_name ( did) , Some ( did) , false , bindings, substs) ;
1538- ResolvedPath { path, param_names : Some ( param_names) , did, is_generic : false }
1521+ bounds. insert (
1522+ 0 ,
1523+ PolyTrait {
1524+ trait_ : ResolvedPath { path, did, is_generic : false } ,
1525+ generic_params : Vec :: new ( ) ,
1526+ } ,
1527+ ) ;
1528+
1529+ DynTrait ( bounds, lifetime)
15391530 }
15401531 ty:: Tuple ( ref t) => {
15411532 Tuple ( t. iter ( ) . map ( |t| t. expect_ty ( ) ) . collect :: < Vec < _ > > ( ) . clean ( cx) )
@@ -2239,14 +2230,9 @@ impl From<GenericBound> for SimpleBound {
22392230 match bound. clone ( ) {
22402231 GenericBound :: Outlives ( l) => SimpleBound :: Outlives ( l) ,
22412232 GenericBound :: TraitBound ( t, mod_) => match t. trait_ {
2242- Type :: ResolvedPath { path, param_names, .. } => SimpleBound :: TraitBound (
2243- path. segments ,
2244- param_names. map_or_else ( Vec :: new, |v| {
2245- v. iter ( ) . map ( |p| SimpleBound :: from ( p. clone ( ) ) ) . collect ( )
2246- } ) ,
2247- t. generic_params ,
2248- mod_,
2249- ) ,
2233+ Type :: ResolvedPath { path, .. } => {
2234+ SimpleBound :: TraitBound ( path. segments , Vec :: new ( ) , t. generic_params , mod_)
2235+ }
22502236 _ => panic ! ( "Unexpected bound {:?}" , bound) ,
22512237 } ,
22522238 }
0 commit comments