@@ -326,7 +326,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
326326 } )
327327 . or_insert ( binding. span ) ;
328328
329- let projection_ty = if let ty:: AssocKind :: Fn = assoc_kind {
329+ let projection_term = if let ty:: AssocKind :: Fn = assoc_kind {
330330 let mut emitted_bad_param_err = None ;
331331 // If we have an method return type bound, then we need to instantiate
332332 // the method's early bound params with suitable late-bound params.
@@ -380,7 +380,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
380380 let output = if let ty:: Alias ( ty:: Projection , alias_ty) = * output. skip_binder ( ) . kind ( )
381381 && tcx. is_impl_trait_in_trait ( alias_ty. def_id )
382382 {
383- alias_ty
383+ alias_ty. into ( )
384384 } else {
385385 return Err ( tcx. dcx ( ) . emit_err ( crate :: errors:: ReturnTypeNotationOnNonRpitit {
386386 span : binding. span ,
@@ -424,7 +424,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
424424 // Note that we're indeed also using `AliasTy` (alias *type*) for associated
425425 // *constants* to represent *const projections*. Alias *term* would be a more
426426 // appropriate name but alas.
427- ty:: AliasTy :: new ( tcx, assoc_item. def_id , alias_args)
427+ ty:: AliasTerm :: new ( tcx, assoc_item. def_id , alias_args)
428428 } ) ;
429429
430430 // Provide the resolved type of the associated constant to `type_of(AnonConst)`.
@@ -461,7 +461,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
461461 // for<'a> <T as Iterator>::Item = &'a str // <-- 'a is bad
462462 // for<'a> <T as FnMut<(&'a u32,)>>::Output = &'a str // <-- 'a is ok
463463 let late_bound_in_projection_ty =
464- tcx. collect_constrained_late_bound_regions ( projection_ty ) ;
464+ tcx. collect_constrained_late_bound_regions ( projection_term ) ;
465465 let late_bound_in_term =
466466 tcx. collect_referenced_late_bound_regions ( trait_ref. rebind ( term) ) ;
467467 debug ! ( ?late_bound_in_projection_ty) ;
@@ -490,8 +490,10 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
490490
491491 bounds. push_projection_bound (
492492 tcx,
493- projection_ty
494- . map_bound ( |projection_ty| ty:: ProjectionPredicate { projection_ty, term } ) ,
493+ projection_term. map_bound ( |projection_term| ty:: ProjectionPredicate {
494+ projection_term,
495+ term,
496+ } ) ,
495497 binding. span ,
496498 ) ;
497499 }
@@ -501,6 +503,8 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
501503 // NOTE: If `only_self_bounds` is true, do NOT expand this associated type bound into
502504 // a trait predicate, since we only want to add predicates for the `Self` type.
503505 if !only_self_bounds. 0 {
506+ let projection_ty = projection_term
507+ . map_bound ( |projection_term| projection_term. expect_ty ( self . tcx ( ) ) ) ;
504508 // Calling `skip_binder` is okay, because `lower_bounds` expects the `param_ty`
505509 // parameter to have a skipped binder.
506510 let param_ty = Ty :: new_alias ( tcx, ty:: Projection , projection_ty. skip_binder ( ) ) ;
0 commit comments