@@ -127,7 +127,7 @@ fn clean_generic_bound<'tcx>(
127127 hir:: GenericBound :: LangItemTrait ( lang_item, span, _, generic_args) => {
128128 let def_id = cx. tcx . require_lang_item ( lang_item, Some ( span) ) ;
129129
130- let trait_ref = ty:: TraitRef :: identity ( cx. tcx , def_id) . skip_binder ( ) ;
130+ let trait_ref = ty:: TraitRef :: identity ( cx. tcx , def_id) ;
131131
132132 let generic_args = clean_generic_args ( generic_args, cx) ;
133133 let GenericArgs :: AngleBracketed { bindings, .. } = generic_args
@@ -156,17 +156,18 @@ fn clean_generic_bound<'tcx>(
156156
157157pub ( crate ) fn clean_trait_ref_with_bindings < ' tcx > (
158158 cx : & mut DocContext < ' tcx > ,
159- trait_ref : ty:: TraitRef < ' tcx > ,
159+ trait_ref : ty:: PolyTraitRef < ' tcx > ,
160160 bindings : ThinVec < TypeBinding > ,
161161) -> 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 ( ) ;
163163 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) ;
165165 }
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 ) ;
168169
169- debug ! ( "ty::TraitRef \n subst: {:?} \n " , trait_ref. substs ) ;
170+ debug ! ( ? trait_ref) ;
170171
171172 path
172173}
@@ -187,7 +188,7 @@ fn clean_poly_trait_ref_with_bindings<'tcx>(
187188 } )
188189 . collect ( ) ;
189190
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) ;
191192 GenericBound :: TraitBound (
192193 PolyTrait { trait_, generic_params : late_bound_regions } ,
193194 hir:: TraitBoundModifier :: None ,
@@ -398,40 +399,39 @@ fn clean_projection_predicate<'tcx>(
398399 } )
399400 . collect ( ) ;
400401
401- let ty:: ProjectionPredicate { projection_ty, term } = pred. skip_binder ( ) ;
402-
403402 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) ) ,
406405 bound_params : late_bound_regions,
407406 }
408407}
409408
410409fn clean_projection < ' tcx > (
411- ty : ty:: ProjectionTy < ' tcx > ,
410+ ty : ty:: Binder < ' tcx , ty :: ProjectionTy < ' tcx > > ,
412411 cx : & mut DocContext < ' tcx > ,
413412 def_id : Option < DefId > ,
414413) -> 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 {
416415 let bounds = cx
417416 . tcx
418- . explicit_item_bounds ( ty. item_def_id )
417+ . explicit_item_bounds ( ty. skip_binder ( ) . item_def_id )
419418 . iter ( )
420- . map ( |( bound, _) | EarlyBinder ( * bound) . subst ( cx. tcx , ty. substs ) )
419+ . map ( |( bound, _) | EarlyBinder ( * bound) . subst ( cx. tcx , ty. skip_binder ( ) . substs ) )
421420 . collect :: < Vec < _ > > ( ) ;
422421 return clean_middle_opaque_bounds ( cx, bounds) ;
423422 }
424423
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 ) ;
427427 let self_def_id = if let Some ( def_id) = def_id {
428428 cx. tcx . opt_parent ( def_id) . or ( Some ( def_id) )
429429 } else {
430430 self_type. def_id ( & cx. cache )
431431 } ;
432432 let should_show_cast = compute_should_show_cast ( self_def_id, & trait_, & self_type) ;
433433 Type :: QPath ( Box :: new ( QPathData {
434- assoc : projection_to_path_segment ( ty, cx) ,
434+ assoc : projection_to_path_segment ( ty. skip_binder ( ) , cx) ,
435435 should_show_cast,
436436 self_type,
437437 trait_,
@@ -783,7 +783,7 @@ fn clean_ty_generics<'tcx>(
783783
784784 let proj = projection. map ( |p| {
785785 (
786- clean_projection ( p. skip_binder ( ) . projection_ty , cx, None ) ,
786+ clean_projection ( p. map_bound ( |p| p . projection_ty ) , cx, None ) ,
787787 p. skip_binder ( ) . term ,
788788 )
789789 } ) ;
@@ -1076,11 +1076,10 @@ fn clean_fn_decl_from_did_and_sig<'tcx>(
10761076 c_variadic : sig. skip_binder ( ) . c_variadic ,
10771077 inputs : Arguments {
10781078 values : sig
1079- . skip_binder ( )
10801079 . inputs ( )
10811080 . iter ( )
10821081 . map ( |t| Argument {
1083- type_ : clean_middle_ty ( * t, cx, None ) ,
1082+ type_ : clean_middle_ty ( * t. skip_binder ( ) , cx, None ) ,
10841083 name : names
10851084 . next ( )
10861085 . map ( |i| i. name )
@@ -1781,7 +1780,7 @@ pub(crate) fn clean_middle_ty<'tcx>(
17811780 }
17821781 ty:: Tuple ( t) => Tuple ( t. iter ( ) . map ( |t| clean_middle_ty ( t, cx, None ) ) . collect ( ) ) ,
17831782
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) ,
17851784
17861785 ty:: Param ( ref p) => {
17871786 if let Some ( bounds) = cx. impl_trait_bounds . remove ( & p. index . into ( ) ) {
0 commit comments