@@ -400,14 +400,19 @@ impl Clean<TyParamBound> for ast::TyParamBound {
400
400
}
401
401
}
402
402
403
- fn external_path ( name : & str ) -> Path {
403
+ fn external_path ( name : & str , substs : & ty :: substs ) -> Path {
404
404
Path {
405
405
global : false ,
406
406
segments : vec ! [ PathSegment {
407
407
name: name. to_string( ) ,
408
- lifetimes: Vec :: new( ) ,
409
- types: Vec :: new( ) ,
410
- } ]
408
+ lifetimes: match substs. regions {
409
+ ty:: ErasedRegions => Vec :: new( ) ,
410
+ ty:: NonerasedRegions ( ref v) => {
411
+ v. iter( ) . filter_map( |v| v. clean( ) ) . collect( )
412
+ }
413
+ } ,
414
+ types: substs. tps. clean( ) ,
415
+ } ] ,
411
416
}
412
417
}
413
418
@@ -418,16 +423,21 @@ impl Clean<TyParamBound> for ty::BuiltinBound {
418
423
core:: Typed ( ref tcx) => tcx,
419
424
core:: NotTyped ( _) => return RegionBound ,
420
425
} ;
426
+ let empty = ty:: substs:: empty ( ) ;
421
427
let ( did, path) = match * self {
422
428
ty:: BoundStatic => return RegionBound ,
423
429
ty:: BoundSend =>
424
- ( tcx. lang_items . send_trait ( ) . unwrap ( ) , external_path ( "Send" ) ) ,
430
+ ( tcx. lang_items . send_trait ( ) . unwrap ( ) ,
431
+ external_path ( "Send" , & empty) ) ,
425
432
ty:: BoundSized =>
426
- ( tcx. lang_items . sized_trait ( ) . unwrap ( ) , external_path ( "Sized" ) ) ,
433
+ ( tcx. lang_items . sized_trait ( ) . unwrap ( ) ,
434
+ external_path ( "Sized" , & empty) ) ,
427
435
ty:: BoundCopy =>
428
- ( tcx. lang_items . copy_trait ( ) . unwrap ( ) , external_path ( "Copy" ) ) ,
436
+ ( tcx. lang_items . copy_trait ( ) . unwrap ( ) ,
437
+ external_path ( "Copy" , & empty) ) ,
429
438
ty:: BoundShare =>
430
- ( tcx. lang_items . share_trait ( ) . unwrap ( ) , external_path ( "Share" ) ) ,
439
+ ( tcx. lang_items . share_trait ( ) . unwrap ( ) ,
440
+ external_path ( "Share" , & empty) ) ,
431
441
} ;
432
442
let fqn = csearch:: get_item_path ( tcx, did) ;
433
443
let fqn = fqn. move_iter ( ) . map ( |i| i. to_str ( ) . to_string ( ) ) . collect ( ) ;
@@ -451,7 +461,8 @@ impl Clean<TyParamBound> for ty::TraitRef {
451
461
let fqn = csearch:: get_item_path ( tcx, self . def_id ) ;
452
462
let fqn = fqn. move_iter ( ) . map ( |i| i. to_str ( ) . to_string ( ) )
453
463
. collect :: < Vec < String > > ( ) ;
454
- let path = external_path ( fqn. last ( ) . unwrap ( ) . as_slice ( ) ) ;
464
+ let path = external_path ( fqn. last ( ) . unwrap ( ) . as_slice ( ) ,
465
+ & self . substs ) ;
455
466
cx. external_paths . borrow_mut ( ) . get_mut_ref ( ) . insert ( self . def_id ,
456
467
( fqn, TypeTrait ) ) ;
457
468
TraitBound ( ResolvedPath {
@@ -1040,26 +1051,16 @@ impl Clean<Type> for ty::t {
1040
1051
let fqn: Vec < String > = fqn. move_iter ( ) . map ( |i| {
1041
1052
i. to_str ( ) . to_string ( )
1042
1053
} ) . collect ( ) ;
1043
- let mut path = external_path ( fqn. last ( )
1044
- . unwrap ( )
1045
- . to_str ( )
1046
- . as_slice ( ) ) ;
1047
1054
let kind = match ty:: get ( * self ) . sty {
1048
1055
ty:: ty_struct( ..) => TypeStruct ,
1049
1056
ty:: ty_trait( ..) => TypeTrait ,
1050
1057
_ => TypeEnum ,
1051
1058
} ;
1052
- path. segments . get_mut ( 0 ) . lifetimes = match substs. regions {
1053
- ty:: ErasedRegions => Vec :: new ( ) ,
1054
- ty:: NonerasedRegions ( ref v) => {
1055
- v. iter ( ) . filter_map ( |v| v. clean ( ) ) . collect ( )
1056
- }
1057
- } ;
1058
- path. segments . get_mut ( 0 ) . types = substs. tps . clean ( ) ;
1059
1059
cx. external_paths . borrow_mut ( ) . get_mut_ref ( ) . insert ( did,
1060
1060
( fqn, kind) ) ;
1061
1061
ResolvedPath {
1062
- path : path,
1062
+ path : external_path ( fqn. last ( ) . unwrap ( ) . to_str ( ) . as_slice ( ) ,
1063
+ substs) ,
1063
1064
typarams : None ,
1064
1065
did : did,
1065
1066
}
0 commit comments