@@ -739,7 +739,7 @@ fn walk_parents<'tcx>(
739
739
span,
740
740
..
741
741
} ) if span. ctxt ( ) == ctxt => {
742
- let ty = cx. tcx . type_of ( owner_id. def_id ) . subst_identity ( ) ;
742
+ let ty = cx. tcx . type_of ( owner_id. def_id ) . instantiate_identity ( ) ;
743
743
Some ( ty_auto_deref_stability ( cx. tcx , cx. param_env , ty, precedence) . position_for_result ( cx) )
744
744
} ,
745
745
@@ -763,7 +763,7 @@ fn walk_parents<'tcx>(
763
763
} ) if span. ctxt ( ) == ctxt => {
764
764
let output = cx
765
765
. tcx
766
- . erase_late_bound_regions ( cx. tcx . fn_sig ( owner_id) . subst_identity ( ) . output ( ) ) ;
766
+ . erase_late_bound_regions ( cx. tcx . fn_sig ( owner_id) . instantiate_identity ( ) . output ( ) ) ;
767
767
Some ( ty_auto_deref_stability ( cx. tcx , cx. param_env , output, precedence) . position_for_result ( cx) )
768
768
} ,
769
769
@@ -785,7 +785,7 @@ fn walk_parents<'tcx>(
785
785
cx. tcx ,
786
786
// Use the param_env of the target type.
787
787
cx. tcx . param_env ( adt. did ( ) ) ,
788
- cx. tcx . type_of ( field_def. did ) . subst_identity ( ) ,
788
+ cx. tcx . type_of ( field_def. did ) . instantiate_identity ( ) ,
789
789
precedence,
790
790
)
791
791
. position_for_arg ( )
@@ -808,7 +808,7 @@ fn walk_parents<'tcx>(
808
808
} else {
809
809
let output = cx
810
810
. tcx
811
- . erase_late_bound_regions ( cx. tcx . fn_sig ( owner_id) . subst_identity ( ) . output ( ) ) ;
811
+ . erase_late_bound_regions ( cx. tcx . fn_sig ( owner_id) . instantiate_identity ( ) . output ( ) ) ;
812
812
ty_auto_deref_stability ( cx. tcx , cx. param_env , output, precedence) . position_for_result ( cx)
813
813
} ,
814
814
)
@@ -879,9 +879,9 @@ fn walk_parents<'tcx>(
879
879
&& let ty:: Ref ( _, sub_ty, _) = * arg_ty. kind ( )
880
880
&& let subs = cx
881
881
. typeck_results ( )
882
- . node_substs_opt ( parent. hir_id ) . map ( |subs| & subs[ 1 ..] ) . unwrap_or_default ( )
882
+ . node_args_opt ( parent. hir_id ) . map ( |subs| & subs[ 1 ..] ) . unwrap_or_default ( )
883
883
&& let impl_ty = if cx. tcx . fn_sig ( fn_id)
884
- . subst_identity ( )
884
+ . instantiate_identity ( )
885
885
. skip_binder ( )
886
886
. inputs ( ) [ 0 ] . is_ref ( )
887
887
{
@@ -905,7 +905,7 @@ fn walk_parents<'tcx>(
905
905
return Some ( Position :: MethodReceiver ) ;
906
906
}
907
907
args. iter ( ) . position ( |arg| arg. hir_id == child_id) . map ( |i| {
908
- let ty = cx. tcx . fn_sig ( fn_id) . subst_identity ( ) . input ( i + 1 ) ;
908
+ let ty = cx. tcx . fn_sig ( fn_id) . instantiate_identity ( ) . input ( i + 1 ) ;
909
909
// `e.hir_id == child_id` for https://github.com/rust-lang/rust-clippy/issues/9739
910
910
// `method.args.is_none()` for https://github.com/rust-lang/rust-clippy/issues/9782
911
911
if e. hir_id == child_id
@@ -1124,10 +1124,10 @@ fn needless_borrow_impl_arg_position<'tcx>(
1124
1124
let sized_trait_def_id = cx. tcx . lang_items ( ) . sized_trait ( ) ;
1125
1125
1126
1126
let Some ( callee_def_id) = fn_def_id ( cx, parent) else { return Position :: Other ( precedence) } ;
1127
- let fn_sig = cx. tcx . fn_sig ( callee_def_id) . subst_identity ( ) . skip_binder ( ) ;
1128
- let substs_with_expr_ty = cx
1127
+ let fn_sig = cx. tcx . fn_sig ( callee_def_id) . instantiate_identity ( ) . skip_binder ( ) ;
1128
+ let args_with_expr_ty = cx
1129
1129
. typeck_results ( )
1130
- . node_substs ( if let ExprKind :: Call ( callee, _) = parent. kind {
1130
+ . node_args ( if let ExprKind :: Call ( callee, _) = parent. kind {
1131
1131
callee. hir_id
1132
1132
} else {
1133
1133
parent. hir_id
@@ -1181,9 +1181,9 @@ fn needless_borrow_impl_arg_position<'tcx>(
1181
1181
return Position :: Other ( precedence) ;
1182
1182
}
1183
1183
1184
- // `substs_with_referent_ty ` can be constructed outside of `check_referent` because the same
1184
+ // `args_with_referent_ty ` can be constructed outside of `check_referent` because the same
1185
1185
// elements are modified each time `check_referent` is called.
1186
- let mut substs_with_referent_ty = substs_with_expr_ty . to_vec ( ) ;
1186
+ let mut args_with_referent_ty = args_with_expr_ty . to_vec ( ) ;
1187
1187
1188
1188
let mut check_reference_and_referent = |reference, referent| {
1189
1189
let referent_ty = cx. typeck_results ( ) . expr_ty ( referent) ;
@@ -1207,7 +1207,7 @@ fn needless_borrow_impl_arg_position<'tcx>(
1207
1207
fn_sig,
1208
1208
arg_index,
1209
1209
& projection_predicates,
1210
- & mut substs_with_referent_ty ,
1210
+ & mut args_with_referent_ty ,
1211
1211
) {
1212
1212
return false ;
1213
1213
}
@@ -1216,14 +1216,14 @@ fn needless_borrow_impl_arg_position<'tcx>(
1216
1216
if let ClauseKind :: Trait ( trait_predicate) = predicate. kind ( ) . skip_binder ( )
1217
1217
&& cx. tcx . is_diagnostic_item ( sym:: IntoIterator , trait_predicate. trait_ref . def_id )
1218
1218
&& let ty:: Param ( param_ty) = trait_predicate. self_ty ( ) . kind ( )
1219
- && let GenericArgKind :: Type ( ty) = substs_with_referent_ty [ param_ty. index as usize ] . unpack ( )
1219
+ && let GenericArgKind :: Type ( ty) = args_with_referent_ty [ param_ty. index as usize ] . unpack ( )
1220
1220
&& ty. is_array ( )
1221
1221
&& !msrv. meets ( msrvs:: ARRAY_INTO_ITERATOR )
1222
1222
{
1223
1223
return false ;
1224
1224
}
1225
1225
1226
- let predicate = EarlyBinder :: bind ( predicate) . subst ( cx. tcx , & substs_with_referent_ty ) ;
1226
+ let predicate = EarlyBinder :: bind ( predicate) . instantiate ( cx. tcx , & args_with_referent_ty ) ;
1227
1227
let obligation = Obligation :: new ( cx. tcx , ObligationCause :: dummy ( ) , cx. param_env , predicate) ;
1228
1228
let infcx = cx. tcx . infer_ctxt ( ) . build ( ) ;
1229
1229
infcx. predicate_must_hold_modulo_regions ( & obligation)
@@ -1252,7 +1252,7 @@ fn has_ref_mut_self_method(cx: &LateContext<'_>, trait_def_id: DefId) -> bool {
1252
1252
. in_definition_order ( )
1253
1253
. any ( |assoc_item| {
1254
1254
if assoc_item. fn_has_self_parameter {
1255
- let self_ty = cx. tcx . fn_sig ( assoc_item. def_id ) . subst_identity ( ) . skip_binder ( ) . inputs ( ) [ 0 ] ;
1255
+ let self_ty = cx. tcx . fn_sig ( assoc_item. def_id ) . instantiate_identity ( ) . skip_binder ( ) . inputs ( ) [ 0 ] ;
1256
1256
matches ! ( self_ty. kind( ) , ty:: Ref ( _, _, Mutability :: Mut ) )
1257
1257
} else {
1258
1258
false
@@ -1323,7 +1323,7 @@ fn referent_used_exactly_once<'tcx>(
1323
1323
}
1324
1324
}
1325
1325
1326
- // Iteratively replaces `param_ty` with `new_ty` in `substs `, and similarly for each resulting
1326
+ // Iteratively replaces `param_ty` with `new_ty` in `args `, and similarly for each resulting
1327
1327
// projected type that is a type parameter. Returns `false` if replacing the types would have an
1328
1328
// effect on the function signature beyond substituting `new_ty` for `param_ty`.
1329
1329
// See: https://github.com/rust-lang/rust-clippy/pull/9136#discussion_r927212757
@@ -1334,11 +1334,11 @@ fn replace_types<'tcx>(
1334
1334
fn_sig : FnSig < ' tcx > ,
1335
1335
arg_index : usize ,
1336
1336
projection_predicates : & [ ProjectionPredicate < ' tcx > ] ,
1337
- substs : & mut [ ty:: GenericArg < ' tcx > ] ,
1337
+ args : & mut [ ty:: GenericArg < ' tcx > ] ,
1338
1338
) -> bool {
1339
- let mut replaced = BitSet :: new_empty ( substs . len ( ) ) ;
1339
+ let mut replaced = BitSet :: new_empty ( args . len ( ) ) ;
1340
1340
1341
- let mut deque = VecDeque :: with_capacity ( substs . len ( ) ) ;
1341
+ let mut deque = VecDeque :: with_capacity ( args . len ( ) ) ;
1342
1342
deque. push_back ( ( param_ty, new_ty) ) ;
1343
1343
1344
1344
while let Some ( ( param_ty, new_ty) ) = deque. pop_front ( ) {
@@ -1352,7 +1352,7 @@ fn replace_types<'tcx>(
1352
1352
return false ;
1353
1353
}
1354
1354
1355
- substs [ param_ty. index as usize ] = ty:: GenericArg :: from ( new_ty) ;
1355
+ args [ param_ty. index as usize ] = ty:: GenericArg :: from ( new_ty) ;
1356
1356
1357
1357
// The `replaced.insert(...)` check provides some protection against infinite loops.
1358
1358
if replaced. insert ( param_ty. index ) {
@@ -1367,7 +1367,7 @@ fn replace_types<'tcx>(
1367
1367
) ) ;
1368
1368
1369
1369
if let Ok ( projected_ty) = cx. tcx . try_normalize_erasing_regions ( cx. param_env , projection)
1370
- && substs [ term_param_ty. index as usize ] != ty:: GenericArg :: from ( projected_ty)
1370
+ && args [ term_param_ty. index as usize ] != ty:: GenericArg :: from ( projected_ty)
1371
1371
{
1372
1372
deque. push_back ( ( * term_param_ty, projected_ty) ) ;
1373
1373
}
@@ -1442,7 +1442,7 @@ fn ty_auto_deref_stability<'tcx>(
1442
1442
ty:: Adt ( ..) if ty. has_placeholders ( ) || ty. has_opaque_types ( ) => {
1443
1443
Position :: ReborrowStable ( precedence) . into ( )
1444
1444
} ,
1445
- ty:: Adt ( _, substs ) if substs . has_non_region_param ( ) => {
1445
+ ty:: Adt ( _, args ) if args . has_non_region_param ( ) => {
1446
1446
TyPosition :: new_deref_stable_for_result ( precedence, ty)
1447
1447
} ,
1448
1448
ty:: Bool
0 commit comments