@@ -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
@@ -1378,30 +1378,9 @@ impl Clean<Type> for hir::Ty<'_> {
13781378 }
13791379 TyKind :: Path ( _) => clean_qpath ( & self , cx) ,
13801380 TyKind :: TraitObject ( ref bounds, ref lifetime, _) => {
1381- let cleaned = bounds[ 0 ] . clean ( cx) ;
1382- match cleaned. trait_ {
1383- ResolvedPath { path, param_names : None , did, is_generic, .. } => {
1384- let mut bounds: Vec < self :: GenericBound > = bounds[ 1 ..]
1385- . iter ( )
1386- . map ( |bound| {
1387- self :: GenericBound :: TraitBound (
1388- bound. clean ( cx) ,
1389- hir:: TraitBoundModifier :: None ,
1390- )
1391- } )
1392- . collect ( ) ;
1393- if !lifetime. is_elided ( ) {
1394- bounds. push ( self :: GenericBound :: Outlives ( lifetime. clean ( cx) ) ) ;
1395- }
1396- ResolvedPath {
1397- path,
1398- param_names : Some ( ( bounds, cleaned. generic_params ) ) ,
1399- did,
1400- is_generic,
1401- }
1402- }
1403- _ => Infer , // shouldn't happen
1404- }
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)
14051384 }
14061385 TyKind :: BareFn ( ref barefn) => BareFunction ( box barefn. clean ( cx) ) ,
14071386 TyKind :: Infer | TyKind :: Err => Infer ,
@@ -1484,7 +1463,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
14841463 } ;
14851464 inline:: record_extern_fqn ( cx, did, kind) ;
14861465 let path = external_path ( cx, cx. tcx . item_name ( did) , None , false , vec ! [ ] , substs) ;
1487- ResolvedPath { path, param_names : None , did, is_generic : false }
1466+ ResolvedPath { path, did, is_generic : false }
14881467 }
14891468 ty:: Foreign ( did) => {
14901469 inline:: record_extern_fqn ( cx, did, ItemType :: ForeignType ) ;
@@ -1496,7 +1475,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
14961475 vec ! [ ] ,
14971476 InternalSubsts :: empty ( ) ,
14981477 ) ;
1499- ResolvedPath { path, param_names : None , did, is_generic : false }
1478+ ResolvedPath { path, did, is_generic : false }
15001479 }
15011480 ty:: Dynamic ( ref obj, ref reg) => {
15021481 // HACK: pick the first `did` as the `did` of the trait object. Someone
@@ -1514,28 +1493,19 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
15141493
15151494 inline:: record_extern_fqn ( cx, did, ItemType :: Trait ) ;
15161495
1517- let mut param_names = vec ! [ ] ;
1518- if let Some ( b) = reg. clean ( cx) {
1519- param_names. push ( GenericBound :: Outlives ( b) ) ;
1520- }
1496+ let lifetime = reg. clean ( cx) ;
1497+ let mut bounds = vec ! [ ] ;
1498+
15211499 for did in dids {
15221500 let empty = cx. tcx . intern_substs ( & [ ] ) ;
15231501 let path =
15241502 external_path ( cx, cx. tcx . item_name ( did) , Some ( did) , false , vec ! [ ] , empty) ;
15251503 inline:: record_extern_fqn ( cx, did, ItemType :: Trait ) ;
1526- let bound = GenericBound :: TraitBound (
1527- PolyTrait {
1528- trait_ : ResolvedPath {
1529- path,
1530- param_names : None ,
1531- did,
1532- is_generic : false ,
1533- } ,
1534- generic_params : Vec :: new ( ) ,
1535- } ,
1536- hir:: TraitBoundModifier :: None ,
1537- ) ;
1538- 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) ;
15391509 }
15401510
15411511 let mut bindings = vec ! [ ] ;
@@ -1548,12 +1518,15 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
15481518
15491519 let path =
15501520 external_path ( cx, cx. tcx . item_name ( did) , Some ( did) , false , bindings, substs) ;
1551- ResolvedPath {
1552- path,
1553- param_names : Some ( ( param_names, vec ! [ ] ) ) ,
1554- did,
1555- is_generic : false ,
1556- }
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)
15571530 }
15581531 ty:: Tuple ( ref t) => {
15591532 Tuple ( t. iter ( ) . map ( |t| t. expect_ty ( ) ) . collect :: < Vec < _ > > ( ) . clean ( cx) )
@@ -2257,14 +2230,9 @@ impl From<GenericBound> for SimpleBound {
22572230 match bound. clone ( ) {
22582231 GenericBound :: Outlives ( l) => SimpleBound :: Outlives ( l) ,
22592232 GenericBound :: TraitBound ( t, mod_) => match t. trait_ {
2260- Type :: ResolvedPath { path, param_names, .. } => SimpleBound :: TraitBound (
2261- path. segments ,
2262- param_names. map_or_else ( Vec :: new, |( v, _) | {
2263- v. iter ( ) . map ( |p| SimpleBound :: from ( p. clone ( ) ) ) . collect ( )
2264- } ) ,
2265- t. generic_params ,
2266- mod_,
2267- ) ,
2233+ Type :: ResolvedPath { path, .. } => {
2234+ SimpleBound :: TraitBound ( path. segments , Vec :: new ( ) , t. generic_params , mod_)
2235+ }
22682236 _ => panic ! ( "Unexpected bound {:?}" , bound) ,
22692237 } ,
22702238 }
0 commit comments