@@ -379,7 +379,7 @@ impl<'tcx> LateLintPass<'tcx> for Dereferencing<'tcx> {
379
379
cx,
380
380
& mut self . possible_borrowers ,
381
381
fn_id,
382
- typeck. node_substs ( hir_id) ,
382
+ typeck. node_args ( hir_id) ,
383
383
i,
384
384
ty,
385
385
expr,
@@ -438,11 +438,11 @@ impl<'tcx> LateLintPass<'tcx> for Dereferencing<'tcx> {
438
438
&& let arg_ty
439
439
= cx. tcx . erase_regions ( use_cx. adjustments . last ( ) . map_or ( expr_ty, |a| a. target ) )
440
440
&& let ty:: Ref ( _, sub_ty, _) = * arg_ty. kind ( )
441
- && let subs = cx
441
+ && let args = cx
442
442
. typeck_results ( )
443
- . node_substs_opt ( hir_id) . map ( |subs | & subs [ 1 ..] ) . unwrap_or_default ( )
443
+ . node_args_opt ( hir_id) . map ( |args | & args [ 1 ..] ) . unwrap_or_default ( )
444
444
&& let impl_ty = if cx. tcx . fn_sig ( fn_id)
445
- . subst_identity ( )
445
+ . instantiate_identity ( )
446
446
. skip_binder ( )
447
447
. inputs ( ) [ 0 ] . is_ref ( )
448
448
{
@@ -455,7 +455,7 @@ impl<'tcx> LateLintPass<'tcx> for Dereferencing<'tcx> {
455
455
&& cx. tcx . infer_ctxt ( ) . build ( )
456
456
. type_implements_trait (
457
457
trait_id,
458
- [ impl_ty. into ( ) ] . into_iter ( ) . chain ( subs . iter ( ) . copied ( ) ) ,
458
+ [ impl_ty. into ( ) ] . into_iter ( ) . chain ( args . iter ( ) . copied ( ) ) ,
459
459
cx. param_env ,
460
460
)
461
461
. must_apply_modulo_regions ( )
@@ -917,10 +917,10 @@ impl TyCoercionStability {
917
917
| ty:: Placeholder ( _)
918
918
| ty:: Dynamic ( ..)
919
919
| ty:: Param ( _) => Self :: Reborrow ,
920
- ty:: Adt ( _, substs )
920
+ ty:: Adt ( _, args )
921
921
if ty. has_placeholders ( )
922
922
|| ty. has_opaque_types ( )
923
- || ( !for_return && substs . has_non_region_param ( ) ) =>
923
+ || ( !for_return && args . has_non_region_param ( ) ) =>
924
924
{
925
925
Self :: Reborrow
926
926
} ,
@@ -992,7 +992,7 @@ fn needless_borrow_generic_arg_count<'tcx>(
992
992
cx : & LateContext < ' tcx > ,
993
993
possible_borrowers : & mut Vec < ( LocalDefId , PossibleBorrowerMap < ' tcx , ' tcx > ) > ,
994
994
fn_id : DefId ,
995
- callee_substs : & ' tcx List < GenericArg < ' tcx > > ,
995
+ callee_args : & ' tcx List < GenericArg < ' tcx > > ,
996
996
arg_index : usize ,
997
997
param_ty : ParamTy ,
998
998
mut expr : & Expr < ' tcx > ,
@@ -1001,7 +1001,7 @@ fn needless_borrow_generic_arg_count<'tcx>(
1001
1001
let destruct_trait_def_id = cx. tcx . lang_items ( ) . destruct_trait ( ) ;
1002
1002
let sized_trait_def_id = cx. tcx . lang_items ( ) . sized_trait ( ) ;
1003
1003
1004
- let fn_sig = cx. tcx . fn_sig ( fn_id) . subst_identity ( ) . skip_binder ( ) ;
1004
+ let fn_sig = cx. tcx . fn_sig ( fn_id) . instantiate_identity ( ) . skip_binder ( ) ;
1005
1005
let predicates = cx. tcx . param_env ( fn_id) . caller_bounds ( ) ;
1006
1006
let projection_predicates = predicates
1007
1007
. iter ( )
@@ -1050,9 +1050,9 @@ fn needless_borrow_generic_arg_count<'tcx>(
1050
1050
return 0 ;
1051
1051
}
1052
1052
1053
- // `substs_with_referent_ty ` can be constructed outside of `check_referent` because the same
1053
+ // `args_with_referent_ty ` can be constructed outside of `check_referent` because the same
1054
1054
// elements are modified each time `check_referent` is called.
1055
- let mut substs_with_referent_ty = callee_substs . to_vec ( ) ;
1055
+ let mut args_with_referent_ty = callee_args . to_vec ( ) ;
1056
1056
1057
1057
let mut check_reference_and_referent = |reference, referent| {
1058
1058
let referent_ty = cx. typeck_results ( ) . expr_ty ( referent) ;
@@ -1076,7 +1076,7 @@ fn needless_borrow_generic_arg_count<'tcx>(
1076
1076
fn_sig,
1077
1077
arg_index,
1078
1078
& projection_predicates,
1079
- & mut substs_with_referent_ty ,
1079
+ & mut args_with_referent_ty ,
1080
1080
) {
1081
1081
return false ;
1082
1082
}
@@ -1085,14 +1085,14 @@ fn needless_borrow_generic_arg_count<'tcx>(
1085
1085
if let ClauseKind :: Trait ( trait_predicate) = predicate. kind ( ) . skip_binder ( )
1086
1086
&& cx. tcx . is_diagnostic_item ( sym:: IntoIterator , trait_predicate. trait_ref . def_id )
1087
1087
&& let ty:: Param ( param_ty) = trait_predicate. self_ty ( ) . kind ( )
1088
- && let GenericArgKind :: Type ( ty) = substs_with_referent_ty [ param_ty. index as usize ] . unpack ( )
1088
+ && let GenericArgKind :: Type ( ty) = args_with_referent_ty [ param_ty. index as usize ] . unpack ( )
1089
1089
&& ty. is_array ( )
1090
1090
&& !msrv. meets ( msrvs:: ARRAY_INTO_ITERATOR )
1091
1091
{
1092
1092
return false ;
1093
1093
}
1094
1094
1095
- let predicate = EarlyBinder :: bind ( predicate) . subst ( cx. tcx , & substs_with_referent_ty ) ;
1095
+ let predicate = EarlyBinder :: bind ( predicate) . instantiate ( cx. tcx , & args_with_referent_ty ) ;
1096
1096
let obligation = Obligation :: new ( cx. tcx , ObligationCause :: dummy ( ) , cx. param_env , predicate) ;
1097
1097
let infcx = cx. tcx . infer_ctxt ( ) . build ( ) ;
1098
1098
infcx. predicate_must_hold_modulo_regions ( & obligation)
@@ -1116,7 +1116,12 @@ fn has_ref_mut_self_method(cx: &LateContext<'_>, trait_def_id: DefId) -> bool {
1116
1116
. in_definition_order ( )
1117
1117
. any ( |assoc_item| {
1118
1118
if assoc_item. fn_has_self_parameter {
1119
- let self_ty = cx. tcx . fn_sig ( assoc_item. def_id ) . subst_identity ( ) . skip_binder ( ) . inputs ( ) [ 0 ] ;
1119
+ let self_ty = cx
1120
+ . tcx
1121
+ . fn_sig ( assoc_item. def_id )
1122
+ . instantiate_identity ( )
1123
+ . skip_binder ( )
1124
+ . inputs ( ) [ 0 ] ;
1120
1125
matches ! ( self_ty. kind( ) , ty:: Ref ( _, _, Mutability :: Mut ) )
1121
1126
} else {
1122
1127
false
@@ -1187,7 +1192,7 @@ fn referent_used_exactly_once<'tcx>(
1187
1192
}
1188
1193
}
1189
1194
1190
- // Iteratively replaces `param_ty` with `new_ty` in `substs `, and similarly for each resulting
1195
+ // Iteratively replaces `param_ty` with `new_ty` in `args `, and similarly for each resulting
1191
1196
// projected type that is a type parameter. Returns `false` if replacing the types would have an
1192
1197
// effect on the function signature beyond substituting `new_ty` for `param_ty`.
1193
1198
// See: https://github.com/rust-lang/rust-clippy/pull/9136#discussion_r927212757
@@ -1198,11 +1203,11 @@ fn replace_types<'tcx>(
1198
1203
fn_sig : FnSig < ' tcx > ,
1199
1204
arg_index : usize ,
1200
1205
projection_predicates : & [ ProjectionPredicate < ' tcx > ] ,
1201
- substs : & mut [ ty:: GenericArg < ' tcx > ] ,
1206
+ args : & mut [ ty:: GenericArg < ' tcx > ] ,
1202
1207
) -> bool {
1203
- let mut replaced = BitSet :: new_empty ( substs . len ( ) ) ;
1208
+ let mut replaced = BitSet :: new_empty ( args . len ( ) ) ;
1204
1209
1205
- let mut deque = VecDeque :: with_capacity ( substs . len ( ) ) ;
1210
+ let mut deque = VecDeque :: with_capacity ( args . len ( ) ) ;
1206
1211
deque. push_back ( ( param_ty, new_ty) ) ;
1207
1212
1208
1213
while let Some ( ( param_ty, new_ty) ) = deque. pop_front ( ) {
@@ -1216,7 +1221,7 @@ fn replace_types<'tcx>(
1216
1221
return false ;
1217
1222
}
1218
1223
1219
- substs [ param_ty. index as usize ] = ty:: GenericArg :: from ( new_ty) ;
1224
+ args [ param_ty. index as usize ] = ty:: GenericArg :: from ( new_ty) ;
1220
1225
1221
1226
// The `replaced.insert(...)` check provides some protection against infinite loops.
1222
1227
if replaced. insert ( param_ty. index ) {
@@ -1231,7 +1236,7 @@ fn replace_types<'tcx>(
1231
1236
) ) ;
1232
1237
1233
1238
if let Ok ( projected_ty) = cx. tcx . try_normalize_erasing_regions ( cx. param_env , projection)
1234
- && substs [ term_param_ty. index as usize ] != ty:: GenericArg :: from ( projected_ty)
1239
+ && args [ term_param_ty. index as usize ] != ty:: GenericArg :: from ( projected_ty)
1235
1240
{
1236
1241
deque. push_back ( ( * term_param_ty, projected_ty) ) ;
1237
1242
}
0 commit comments