@@ -739,7 +739,7 @@ fn walk_parents<'tcx>(
739739 span,
740740 ..
741741 } ) 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 ( ) ;
743743 Some ( ty_auto_deref_stability ( cx. tcx , cx. param_env , ty, precedence) . position_for_result ( cx) )
744744 } ,
745745
@@ -763,7 +763,7 @@ fn walk_parents<'tcx>(
763763 } ) if span. ctxt ( ) == ctxt => {
764764 let output = cx
765765 . 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 ( ) ) ;
767767 Some ( ty_auto_deref_stability ( cx. tcx , cx. param_env , output, precedence) . position_for_result ( cx) )
768768 } ,
769769
@@ -785,7 +785,7 @@ fn walk_parents<'tcx>(
785785 cx. tcx ,
786786 // Use the param_env of the target type.
787787 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 ( ) ,
789789 precedence,
790790 )
791791 . position_for_arg ( )
@@ -808,7 +808,7 @@ fn walk_parents<'tcx>(
808808 } else {
809809 let output = cx
810810 . 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 ( ) ) ;
812812 ty_auto_deref_stability ( cx. tcx , cx. param_env , output, precedence) . position_for_result ( cx)
813813 } ,
814814 )
@@ -879,9 +879,9 @@ fn walk_parents<'tcx>(
879879 && let ty:: Ref ( _, sub_ty, _) = * arg_ty. kind ( )
880880 && let subs = cx
881881 . 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 ( )
883883 && let impl_ty = if cx. tcx . fn_sig ( fn_id)
884- . subst_identity ( )
884+ . instantiate_identity ( )
885885 . skip_binder ( )
886886 . inputs ( ) [ 0 ] . is_ref ( )
887887 {
@@ -905,7 +905,7 @@ fn walk_parents<'tcx>(
905905 return Some ( Position :: MethodReceiver ) ;
906906 }
907907 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 ) ;
909909 // `e.hir_id == child_id` for https://github.com/rust-lang/rust-clippy/issues/9739
910910 // `method.args.is_none()` for https://github.com/rust-lang/rust-clippy/issues/9782
911911 if e. hir_id == child_id
@@ -1124,10 +1124,10 @@ fn needless_borrow_impl_arg_position<'tcx>(
11241124 let sized_trait_def_id = cx. tcx . lang_items ( ) . sized_trait ( ) ;
11251125
11261126 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
11291129 . typeck_results ( )
1130- . node_substs ( if let ExprKind :: Call ( callee, _) = parent. kind {
1130+ . node_args ( if let ExprKind :: Call ( callee, _) = parent. kind {
11311131 callee. hir_id
11321132 } else {
11331133 parent. hir_id
@@ -1181,9 +1181,9 @@ fn needless_borrow_impl_arg_position<'tcx>(
11811181 return Position :: Other ( precedence) ;
11821182 }
11831183
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
11851185 // 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 ( ) ;
11871187
11881188 let mut check_reference_and_referent = |reference, referent| {
11891189 let referent_ty = cx. typeck_results ( ) . expr_ty ( referent) ;
@@ -1207,7 +1207,7 @@ fn needless_borrow_impl_arg_position<'tcx>(
12071207 fn_sig,
12081208 arg_index,
12091209 & projection_predicates,
1210- & mut substs_with_referent_ty ,
1210+ & mut args_with_referent_ty ,
12111211 ) {
12121212 return false ;
12131213 }
@@ -1216,14 +1216,14 @@ fn needless_borrow_impl_arg_position<'tcx>(
12161216 if let ClauseKind :: Trait ( trait_predicate) = predicate. kind ( ) . skip_binder ( )
12171217 && cx. tcx . is_diagnostic_item ( sym:: IntoIterator , trait_predicate. trait_ref . def_id )
12181218 && 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 ( )
12201220 && ty. is_array ( )
12211221 && !msrv. meets ( msrvs:: ARRAY_INTO_ITERATOR )
12221222 {
12231223 return false ;
12241224 }
12251225
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 ) ;
12271227 let obligation = Obligation :: new ( cx. tcx , ObligationCause :: dummy ( ) , cx. param_env , predicate) ;
12281228 let infcx = cx. tcx . infer_ctxt ( ) . build ( ) ;
12291229 infcx. predicate_must_hold_modulo_regions ( & obligation)
@@ -1252,7 +1252,7 @@ fn has_ref_mut_self_method(cx: &LateContext<'_>, trait_def_id: DefId) -> bool {
12521252 . in_definition_order ( )
12531253 . any ( |assoc_item| {
12541254 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 ] ;
12561256 matches ! ( self_ty. kind( ) , ty:: Ref ( _, _, Mutability :: Mut ) )
12571257 } else {
12581258 false
@@ -1323,7 +1323,7 @@ fn referent_used_exactly_once<'tcx>(
13231323 }
13241324}
13251325
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
13271327// projected type that is a type parameter. Returns `false` if replacing the types would have an
13281328// effect on the function signature beyond substituting `new_ty` for `param_ty`.
13291329// See: https://github.com/rust-lang/rust-clippy/pull/9136#discussion_r927212757
@@ -1334,11 +1334,11 @@ fn replace_types<'tcx>(
13341334 fn_sig : FnSig < ' tcx > ,
13351335 arg_index : usize ,
13361336 projection_predicates : & [ ProjectionPredicate < ' tcx > ] ,
1337- substs : & mut [ ty:: GenericArg < ' tcx > ] ,
1337+ args : & mut [ ty:: GenericArg < ' tcx > ] ,
13381338) -> bool {
1339- let mut replaced = BitSet :: new_empty ( substs . len ( ) ) ;
1339+ let mut replaced = BitSet :: new_empty ( args . len ( ) ) ;
13401340
1341- let mut deque = VecDeque :: with_capacity ( substs . len ( ) ) ;
1341+ let mut deque = VecDeque :: with_capacity ( args . len ( ) ) ;
13421342 deque. push_back ( ( param_ty, new_ty) ) ;
13431343
13441344 while let Some ( ( param_ty, new_ty) ) = deque. pop_front ( ) {
@@ -1352,7 +1352,7 @@ fn replace_types<'tcx>(
13521352 return false ;
13531353 }
13541354
1355- substs [ param_ty. index as usize ] = ty:: GenericArg :: from ( new_ty) ;
1355+ args [ param_ty. index as usize ] = ty:: GenericArg :: from ( new_ty) ;
13561356
13571357 // The `replaced.insert(...)` check provides some protection against infinite loops.
13581358 if replaced. insert ( param_ty. index ) {
@@ -1367,7 +1367,7 @@ fn replace_types<'tcx>(
13671367 ) ) ;
13681368
13691369 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)
13711371 {
13721372 deque. push_back ( ( * term_param_ty, projected_ty) ) ;
13731373 }
@@ -1442,7 +1442,7 @@ fn ty_auto_deref_stability<'tcx>(
14421442 ty:: Adt ( ..) if ty. has_placeholders ( ) || ty. has_opaque_types ( ) => {
14431443 Position :: ReborrowStable ( precedence) . into ( )
14441444 } ,
1445- ty:: Adt ( _, substs ) if substs . has_non_region_param ( ) => {
1445+ ty:: Adt ( _, args ) if args . has_non_region_param ( ) => {
14461446 TyPosition :: new_deref_stable_for_result ( precedence, ty)
14471447 } ,
14481448 ty:: Bool
0 commit comments