@@ -12,7 +12,7 @@ use rustc_index::bit_set::BitSet;
12
12
use rustc_infer:: infer:: TyCtxtInferExt ;
13
13
use rustc_lint:: { LateContext , LateLintPass } ;
14
14
use rustc_middle:: ty:: {
15
- self , ClauseKind , EarlyBinder , FnSig , GenericArg , GenericArgKind , List , ParamTy , ProjectionPredicate , Ty ,
15
+ self , ClauseKind , EarlyBinder , FnSig , GenericArg , GenericArgKind , ParamTy , ProjectionPredicate , Ty ,
16
16
} ;
17
17
use rustc_session:: impl_lint_pass;
18
18
use rustc_span:: symbol:: sym;
@@ -157,7 +157,7 @@ fn path_has_args(p: &QPath<'_>) -> bool {
157
157
fn needless_borrow_count < ' tcx > (
158
158
cx : & LateContext < ' tcx > ,
159
159
fn_id : DefId ,
160
- callee_args : & ' tcx List < GenericArg < ' tcx > > ,
160
+ callee_args : ty :: GenericArgsRef < ' tcx > ,
161
161
arg_index : usize ,
162
162
param_ty : ParamTy ,
163
163
mut expr : & Expr < ' tcx > ,
@@ -316,11 +316,11 @@ fn is_mixed_projection_predicate<'tcx>(
316
316
&& ( term_param_ty. index as usize ) < generics. parent_count
317
317
{
318
318
// The inner-most self type is a type parameter from the current function.
319
- let mut projection_ty = projection_predicate. projection_ty ;
319
+ let mut projection_term = projection_predicate. projection_term ;
320
320
loop {
321
- match projection_ty . self_ty ( ) . kind ( ) {
321
+ match * projection_term . self_ty ( ) . kind ( ) {
322
322
ty:: Alias ( ty:: Projection , inner_projection_ty) => {
323
- projection_ty = * inner_projection_ty;
323
+ projection_term = inner_projection_ty. into ( ) ;
324
324
} ,
325
325
ty:: Param ( param_ty) => {
326
326
return ( param_ty. index as usize ) >= generics. parent_count ;
@@ -369,14 +369,15 @@ fn replace_types<'tcx>(
369
369
// The `replaced.insert(...)` check provides some protection against infinite loops.
370
370
if replaced. insert ( param_ty. index ) {
371
371
for projection_predicate in projection_predicates {
372
- if projection_predicate. projection_ty . self_ty ( ) == param_ty. to_ty ( cx. tcx )
372
+ if projection_predicate. projection_term . self_ty ( ) == param_ty. to_ty ( cx. tcx )
373
373
&& let Some ( term_ty) = projection_predicate. term . ty ( )
374
374
&& let ty:: Param ( term_param_ty) = term_ty. kind ( )
375
375
{
376
- let projection = cx. tcx . mk_ty_from_kind ( ty:: Alias (
377
- ty:: Projection ,
378
- projection_predicate. projection_ty . with_self_ty ( cx. tcx , new_ty) ,
379
- ) ) ;
376
+ let projection = projection_predicate
377
+ . projection_term
378
+ . with_self_ty ( cx. tcx , new_ty)
379
+ . expect_ty ( cx. tcx )
380
+ . to_ty ( cx. tcx ) ;
380
381
381
382
if let Ok ( projected_ty) = cx. tcx . try_normalize_erasing_regions ( cx. param_env , projection)
382
383
&& args[ term_param_ty. index as usize ] != GenericArg :: from ( projected_ty)
0 commit comments