@@ -127,7 +127,7 @@ fn clean_generic_bound<'tcx>(
127
127
hir:: GenericBound :: LangItemTrait ( lang_item, span, _, generic_args) => {
128
128
let def_id = cx. tcx . require_lang_item ( lang_item, Some ( span) ) ;
129
129
130
- let trait_ref = ty:: TraitRef :: identity ( cx. tcx , def_id) . skip_binder ( ) ;
130
+ let trait_ref = ty:: TraitRef :: identity ( cx. tcx , def_id) ;
131
131
132
132
let generic_args = clean_generic_args ( generic_args, cx) ;
133
133
let GenericArgs :: AngleBracketed { bindings, .. } = generic_args
@@ -156,17 +156,18 @@ fn clean_generic_bound<'tcx>(
156
156
157
157
pub ( crate ) fn clean_trait_ref_with_bindings < ' tcx > (
158
158
cx : & mut DocContext < ' tcx > ,
159
- trait_ref : ty:: TraitRef < ' tcx > ,
159
+ trait_ref : ty:: PolyTraitRef < ' tcx > ,
160
160
bindings : ThinVec < TypeBinding > ,
161
161
) -> Path {
162
- let kind = cx. tcx . def_kind ( trait_ref. def_id ) . into ( ) ;
162
+ let kind = cx. tcx . def_kind ( trait_ref. def_id ( ) ) . into ( ) ;
163
163
if !matches ! ( kind, ItemType :: Trait | ItemType :: TraitAlias ) {
164
- span_bug ! ( cx. tcx. def_span( trait_ref. def_id) , "`TraitRef` had unexpected kind {:?}" , kind) ;
164
+ span_bug ! ( cx. tcx. def_span( trait_ref. def_id( ) ) , "`TraitRef` had unexpected kind {:?}" , kind) ;
165
165
}
166
- inline:: record_extern_fqn ( cx, trait_ref. def_id , kind) ;
167
- let path = external_path ( cx, trait_ref. def_id , true , bindings, trait_ref. substs ) ;
166
+ inline:: record_extern_fqn ( cx, trait_ref. def_id ( ) , kind) ;
167
+ let path =
168
+ external_path ( cx, trait_ref. def_id ( ) , true , bindings, trait_ref. skip_binder ( ) . substs ) ;
168
169
169
- debug ! ( "ty::TraitRef \n subst: {:?} \n " , trait_ref. substs ) ;
170
+ debug ! ( ? trait_ref) ;
170
171
171
172
path
172
173
}
@@ -187,7 +188,7 @@ fn clean_poly_trait_ref_with_bindings<'tcx>(
187
188
} )
188
189
. collect ( ) ;
189
190
190
- let trait_ = clean_trait_ref_with_bindings ( cx, poly_trait_ref. skip_binder ( ) , bindings) ;
191
+ let trait_ = clean_trait_ref_with_bindings ( cx, poly_trait_ref, bindings) ;
191
192
GenericBound :: TraitBound (
192
193
PolyTrait { trait_, generic_params : late_bound_regions } ,
193
194
hir:: TraitBoundModifier :: None ,
@@ -398,40 +399,39 @@ fn clean_projection_predicate<'tcx>(
398
399
} )
399
400
. collect ( ) ;
400
401
401
- let ty:: ProjectionPredicate { projection_ty, term } = pred. skip_binder ( ) ;
402
-
403
402
WherePredicate :: EqPredicate {
404
- lhs : Box :: new ( clean_projection ( projection_ty, cx, None ) ) ,
405
- rhs : Box :: new ( clean_middle_term ( term, cx) ) ,
403
+ lhs : Box :: new ( clean_projection ( pred . map_bound ( |p| p . projection_ty ) , cx, None ) ) ,
404
+ rhs : Box :: new ( clean_middle_term ( pred . skip_binder ( ) . term , cx) ) ,
406
405
bound_params : late_bound_regions,
407
406
}
408
407
}
409
408
410
409
fn clean_projection < ' tcx > (
411
- ty : ty:: ProjectionTy < ' tcx > ,
410
+ ty : ty:: Binder < ' tcx , ty :: ProjectionTy < ' tcx > > ,
412
411
cx : & mut DocContext < ' tcx > ,
413
412
def_id : Option < DefId > ,
414
413
) -> Type {
415
- if cx. tcx . def_kind ( ty. item_def_id ) == DefKind :: ImplTraitPlaceholder {
414
+ if cx. tcx . def_kind ( ty. skip_binder ( ) . item_def_id ) == DefKind :: ImplTraitPlaceholder {
416
415
let bounds = cx
417
416
. tcx
418
- . explicit_item_bounds ( ty. item_def_id )
417
+ . explicit_item_bounds ( ty. skip_binder ( ) . item_def_id )
419
418
. iter ( )
420
- . map ( |( bound, _) | EarlyBinder ( * bound) . subst ( cx. tcx , ty. substs ) )
419
+ . map ( |( bound, _) | EarlyBinder ( * bound) . subst ( cx. tcx , ty. skip_binder ( ) . substs ) )
421
420
. collect :: < Vec < _ > > ( ) ;
422
421
return clean_middle_opaque_bounds ( cx, bounds) ;
423
422
}
424
423
425
- let trait_ = clean_trait_ref_with_bindings ( cx, ty. trait_ref ( cx. tcx ) , ThinVec :: new ( ) ) ;
426
- let self_type = clean_middle_ty ( ty. self_ty ( ) , cx, None ) ;
424
+ let trait_ =
425
+ clean_trait_ref_with_bindings ( cx, ty. map_bound ( |ty| ty. trait_ref ( cx. tcx ) ) , ThinVec :: new ( ) ) ;
426
+ let self_type = clean_middle_ty ( ty. skip_binder ( ) . self_ty ( ) , cx, None ) ;
427
427
let self_def_id = if let Some ( def_id) = def_id {
428
428
cx. tcx . opt_parent ( def_id) . or ( Some ( def_id) )
429
429
} else {
430
430
self_type. def_id ( & cx. cache )
431
431
} ;
432
432
let should_show_cast = compute_should_show_cast ( self_def_id, & trait_, & self_type) ;
433
433
Type :: QPath ( Box :: new ( QPathData {
434
- assoc : projection_to_path_segment ( ty, cx) ,
434
+ assoc : projection_to_path_segment ( ty. skip_binder ( ) , cx) ,
435
435
should_show_cast,
436
436
self_type,
437
437
trait_,
@@ -783,7 +783,7 @@ fn clean_ty_generics<'tcx>(
783
783
784
784
let proj = projection. map ( |p| {
785
785
(
786
- clean_projection ( p. skip_binder ( ) . projection_ty , cx, None ) ,
786
+ clean_projection ( p. map_bound ( |p| p . projection_ty ) , cx, None ) ,
787
787
p. skip_binder ( ) . term ,
788
788
)
789
789
} ) ;
@@ -1076,11 +1076,10 @@ fn clean_fn_decl_from_did_and_sig<'tcx>(
1076
1076
c_variadic : sig. skip_binder ( ) . c_variadic ,
1077
1077
inputs : Arguments {
1078
1078
values : sig
1079
- . skip_binder ( )
1080
1079
. inputs ( )
1081
1080
. iter ( )
1082
1081
. map ( |t| Argument {
1083
- type_ : clean_middle_ty ( * t, cx, None ) ,
1082
+ type_ : clean_middle_ty ( * t. skip_binder ( ) , cx, None ) ,
1084
1083
name : names
1085
1084
. next ( )
1086
1085
. map ( |i| i. name )
@@ -1781,7 +1780,7 @@ pub(crate) fn clean_middle_ty<'tcx>(
1781
1780
}
1782
1781
ty:: Tuple ( t) => Tuple ( t. iter ( ) . map ( |t| clean_middle_ty ( t, cx, None ) ) . collect ( ) ) ,
1783
1782
1784
- ty:: Projection ( ref data) => clean_projection ( * data, cx, def_id) ,
1783
+ ty:: Projection ( ref data) => clean_projection ( ty :: Binder :: dummy ( * data) , cx, def_id) ,
1785
1784
1786
1785
ty:: Param ( ref p) => {
1787
1786
if let Some ( bounds) = cx. impl_trait_bounds . remove ( & p. index . into ( ) ) {
0 commit comments