@@ -165,7 +165,7 @@ pub(crate) fn clean_trait_ref_with_bindings<'tcx>(
165
165
}
166
166
inline:: record_extern_fqn ( cx, trait_ref. def_id ( ) , kind) ;
167
167
let path =
168
- external_path ( cx, trait_ref. def_id ( ) , true , bindings, trait_ref. skip_binder ( ) . substs ) ;
168
+ external_path ( cx, trait_ref. def_id ( ) , true , bindings, trait_ref. map_bound ( |tr| tr . substs ) ) ;
169
169
170
170
debug ! ( ?trait_ref) ;
171
171
@@ -437,7 +437,7 @@ fn clean_projection<'tcx>(
437
437
} ;
438
438
let should_show_cast = compute_should_show_cast ( self_def_id, & trait_, & self_type) ;
439
439
Type :: QPath ( Box :: new ( QPathData {
440
- assoc : projection_to_path_segment ( ty. skip_binder ( ) , cx) ,
440
+ assoc : projection_to_path_segment ( ty, cx) ,
441
441
should_show_cast,
442
442
self_type,
443
443
trait_,
@@ -452,15 +452,16 @@ fn compute_should_show_cast(self_def_id: Option<DefId>, trait_: &Path, self_type
452
452
}
453
453
454
454
fn projection_to_path_segment < ' tcx > (
455
- ty : ty:: ProjectionTy < ' tcx > ,
455
+ ty : ty:: Binder < ' tcx , ty :: ProjectionTy < ' tcx > > ,
456
456
cx : & mut DocContext < ' tcx > ,
457
457
) -> PathSegment {
458
- let item = cx. tcx . associated_item ( ty. item_def_id ) ;
459
- let generics = cx. tcx . generics_of ( ty. item_def_id ) ;
458
+ let item = cx. tcx . associated_item ( ty. skip_binder ( ) . item_def_id ) ;
459
+ let generics = cx. tcx . generics_of ( ty. skip_binder ( ) . item_def_id ) ;
460
460
PathSegment {
461
461
name : item. name ,
462
462
args : GenericArgs :: AngleBracketed {
463
- args : substs_to_args ( cx, & ty. substs [ generics. parent_count ..] , false ) . into ( ) ,
463
+ args : substs_to_args ( cx, ty. map_bound ( |ty| & ty. substs [ generics. parent_count ..] ) , false )
464
+ . into ( ) ,
464
465
bindings : Default :: default ( ) ,
465
466
} ,
466
467
}
@@ -1732,12 +1733,18 @@ pub(crate) fn clean_middle_ty<'tcx>(
1732
1733
AdtKind :: Enum => ItemType :: Enum ,
1733
1734
} ;
1734
1735
inline:: record_extern_fqn ( cx, did, kind) ;
1735
- let path = external_path ( cx, did, false , ThinVec :: new ( ) , substs) ;
1736
+ let path = external_path ( cx, did, false , ThinVec :: new ( ) , bound_ty . rebind ( substs) ) ;
1736
1737
Type :: Path { path }
1737
1738
}
1738
1739
ty:: Foreign ( did) => {
1739
1740
inline:: record_extern_fqn ( cx, did, ItemType :: ForeignType ) ;
1740
- let path = external_path ( cx, did, false , ThinVec :: new ( ) , InternalSubsts :: empty ( ) ) ;
1741
+ let path = external_path (
1742
+ cx,
1743
+ did,
1744
+ false ,
1745
+ ThinVec :: new ( ) ,
1746
+ ty:: Binder :: dummy ( InternalSubsts :: empty ( ) ) ,
1747
+ ) ;
1741
1748
Type :: Path { path }
1742
1749
}
1743
1750
ty:: Dynamic ( obj, ref reg, _) => {
@@ -1750,9 +1757,9 @@ pub(crate) fn clean_middle_ty<'tcx>(
1750
1757
. or_else ( || dids. next ( ) )
1751
1758
. unwrap_or_else ( || panic ! ( "found trait object `{bound_ty:?}` with no traits?" ) ) ;
1752
1759
let substs = match obj. principal ( ) {
1753
- Some ( principal) => principal. skip_binder ( ) . substs ,
1760
+ Some ( principal) => principal. map_bound ( |p| p . substs ) ,
1754
1761
// marker traits have no substs.
1755
- _ => cx . tcx . intern_substs ( & [ ] ) ,
1762
+ _ => ty :: Binder :: dummy ( InternalSubsts :: empty ( ) ) ,
1756
1763
} ;
1757
1764
1758
1765
inline:: record_extern_fqn ( cx, did, ItemType :: Trait ) ;
@@ -1763,7 +1770,7 @@ pub(crate) fn clean_middle_ty<'tcx>(
1763
1770
let lifetime = clean_middle_region ( * reg) ;
1764
1771
let mut bounds = dids
1765
1772
. map ( |did| {
1766
- let empty = cx . tcx . intern_substs ( & [ ] ) ;
1773
+ let empty = ty :: Binder :: dummy ( InternalSubsts :: empty ( ) ) ;
1767
1774
let path = external_path ( cx, did, false , ThinVec :: new ( ) , empty) ;
1768
1775
inline:: record_extern_fqn ( cx, did, ItemType :: Trait ) ;
1769
1776
PolyTrait { trait_ : path, generic_params : Vec :: new ( ) }
@@ -1774,11 +1781,13 @@ pub(crate) fn clean_middle_ty<'tcx>(
1774
1781
. projection_bounds ( )
1775
1782
. map ( |pb| TypeBinding {
1776
1783
assoc : projection_to_path_segment (
1777
- pb. skip_binder ( )
1778
- // HACK(compiler-errors): Doesn't actually matter what self
1779
- // type we put here, because we're only using the GAT's substs.
1780
- . with_self_ty ( cx. tcx , cx. tcx . types . self_param )
1781
- . projection_ty ,
1784
+ pb. map_bound ( |pb| {
1785
+ pb
1786
+ // HACK(compiler-errors): Doesn't actually matter what self
1787
+ // type we put here, because we're only using the GAT's substs.
1788
+ . with_self_ty ( cx. tcx , cx. tcx . types . self_param )
1789
+ . projection_ty
1790
+ } ) ,
1782
1791
cx,
1783
1792
) ,
1784
1793
kind : TypeBindingKind :: Equality {
@@ -1883,7 +1892,10 @@ fn clean_middle_opaque_bounds<'tcx>(
1883
1892
{
1884
1893
if proj. projection_ty . trait_ref ( cx. tcx ) == trait_ref. skip_binder ( ) {
1885
1894
Some ( TypeBinding {
1886
- assoc : projection_to_path_segment ( proj. projection_ty , cx) ,
1895
+ assoc : projection_to_path_segment (
1896
+ bound. kind ( ) . rebind ( proj. projection_ty ) ,
1897
+ cx,
1898
+ ) ,
1887
1899
kind : TypeBindingKind :: Equality {
1888
1900
term : clean_middle_term ( bound. kind ( ) . rebind ( proj. term ) , cx) ,
1889
1901
} ,
0 commit comments