@@ -326,7 +326,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
326
326
} )
327
327
. or_insert ( binding. span ) ;
328
328
329
- let projection_ty = if let ty:: AssocKind :: Fn = assoc_kind {
329
+ let projection_term = if let ty:: AssocKind :: Fn = assoc_kind {
330
330
let mut emitted_bad_param_err = None ;
331
331
// If we have an method return type bound, then we need to instantiate
332
332
// the method's early bound params with suitable late-bound params.
@@ -380,7 +380,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
380
380
let output = if let ty:: Alias ( ty:: Projection , alias_ty) = * output. skip_binder ( ) . kind ( )
381
381
&& tcx. is_impl_trait_in_trait ( alias_ty. def_id )
382
382
{
383
- alias_ty
383
+ alias_ty. into ( )
384
384
} else {
385
385
return Err ( tcx. dcx ( ) . emit_err ( crate :: errors:: ReturnTypeNotationOnNonRpitit {
386
386
span : binding. span ,
@@ -424,7 +424,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
424
424
// Note that we're indeed also using `AliasTy` (alias *type*) for associated
425
425
// *constants* to represent *const projections*. Alias *term* would be a more
426
426
// 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)
428
428
} ) ;
429
429
430
430
// Provide the resolved type of the associated constant to `type_of(AnonConst)`.
@@ -461,7 +461,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
461
461
// for<'a> <T as Iterator>::Item = &'a str // <-- 'a is bad
462
462
// for<'a> <T as FnMut<(&'a u32,)>>::Output = &'a str // <-- 'a is ok
463
463
let late_bound_in_projection_ty =
464
- tcx. collect_constrained_late_bound_regions ( projection_ty ) ;
464
+ tcx. collect_constrained_late_bound_regions ( projection_term ) ;
465
465
let late_bound_in_term =
466
466
tcx. collect_referenced_late_bound_regions ( trait_ref. rebind ( term) ) ;
467
467
debug ! ( ?late_bound_in_projection_ty) ;
@@ -490,8 +490,10 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
490
490
491
491
bounds. push_projection_bound (
492
492
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
+ } ) ,
495
497
binding. span ,
496
498
) ;
497
499
}
@@ -501,6 +503,8 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
501
503
// NOTE: If `only_self_bounds` is true, do NOT expand this associated type bound into
502
504
// a trait predicate, since we only want to add predicates for the `Self` type.
503
505
if !only_self_bounds. 0 {
506
+ let projection_ty = projection_term
507
+ . map_bound ( |projection_term| projection_term. expect_ty ( self . tcx ( ) ) ) ;
504
508
// Calling `skip_binder` is okay, because `lower_bounds` expects the `param_ty`
505
509
// parameter to have a skipped binder.
506
510
let param_ty = Ty :: new_alias ( tcx, ty:: Projection , projection_ty. skip_binder ( ) ) ;
0 commit comments