@@ -379,7 +379,7 @@ impl<'tcx> LateLintPass<'tcx> for Dereferencing<'tcx> {
379379 cx,
380380 & mut self . possible_borrowers ,
381381 fn_id,
382- typeck. node_substs ( hir_id) ,
382+ typeck. node_args ( hir_id) ,
383383 i,
384384 ty,
385385 expr,
@@ -438,11 +438,11 @@ impl<'tcx> LateLintPass<'tcx> for Dereferencing<'tcx> {
438438 && let arg_ty
439439 = cx. tcx . erase_regions ( use_cx. adjustments . last ( ) . map_or ( expr_ty, |a| a. target ) )
440440 && let ty:: Ref ( _, sub_ty, _) = * arg_ty. kind ( )
441- && let subs = cx
441+ && let args = cx
442442 . 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 ( )
444444 && let impl_ty = if cx. tcx . fn_sig ( fn_id)
445- . subst_identity ( )
445+ . instantiate_identity ( )
446446 . skip_binder ( )
447447 . inputs ( ) [ 0 ] . is_ref ( )
448448 {
@@ -455,7 +455,7 @@ impl<'tcx> LateLintPass<'tcx> for Dereferencing<'tcx> {
455455 && cx. tcx . infer_ctxt ( ) . build ( )
456456 . type_implements_trait (
457457 trait_id,
458- [ impl_ty. into ( ) ] . into_iter ( ) . chain ( subs . iter ( ) . copied ( ) ) ,
458+ [ impl_ty. into ( ) ] . into_iter ( ) . chain ( args . iter ( ) . copied ( ) ) ,
459459 cx. param_env ,
460460 )
461461 . must_apply_modulo_regions ( )
@@ -917,10 +917,10 @@ impl TyCoercionStability {
917917 | ty:: Placeholder ( _)
918918 | ty:: Dynamic ( ..)
919919 | ty:: Param ( _) => Self :: Reborrow ,
920- ty:: Adt ( _, substs )
920+ ty:: Adt ( _, args )
921921 if ty. has_placeholders ( )
922922 || ty. has_opaque_types ( )
923- || ( !for_return && substs . has_non_region_param ( ) ) =>
923+ || ( !for_return && args . has_non_region_param ( ) ) =>
924924 {
925925 Self :: Reborrow
926926 } ,
@@ -992,7 +992,7 @@ fn needless_borrow_generic_arg_count<'tcx>(
992992 cx : & LateContext < ' tcx > ,
993993 possible_borrowers : & mut Vec < ( LocalDefId , PossibleBorrowerMap < ' tcx , ' tcx > ) > ,
994994 fn_id : DefId ,
995- callee_substs : & ' tcx List < GenericArg < ' tcx > > ,
995+ callee_args : & ' tcx List < GenericArg < ' tcx > > ,
996996 arg_index : usize ,
997997 param_ty : ParamTy ,
998998 mut expr : & Expr < ' tcx > ,
@@ -1001,7 +1001,7 @@ fn needless_borrow_generic_arg_count<'tcx>(
10011001 let destruct_trait_def_id = cx. tcx . lang_items ( ) . destruct_trait ( ) ;
10021002 let sized_trait_def_id = cx. tcx . lang_items ( ) . sized_trait ( ) ;
10031003
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 ( ) ;
10051005 let predicates = cx. tcx . param_env ( fn_id) . caller_bounds ( ) ;
10061006 let projection_predicates = predicates
10071007 . iter ( )
@@ -1050,9 +1050,9 @@ fn needless_borrow_generic_arg_count<'tcx>(
10501050 return 0 ;
10511051 }
10521052
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
10541054 // 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 ( ) ;
10561056
10571057 let mut check_reference_and_referent = |reference, referent| {
10581058 let referent_ty = cx. typeck_results ( ) . expr_ty ( referent) ;
@@ -1076,7 +1076,7 @@ fn needless_borrow_generic_arg_count<'tcx>(
10761076 fn_sig,
10771077 arg_index,
10781078 & projection_predicates,
1079- & mut substs_with_referent_ty ,
1079+ & mut args_with_referent_ty ,
10801080 ) {
10811081 return false ;
10821082 }
@@ -1085,14 +1085,14 @@ fn needless_borrow_generic_arg_count<'tcx>(
10851085 if let ClauseKind :: Trait ( trait_predicate) = predicate. kind ( ) . skip_binder ( )
10861086 && cx. tcx . is_diagnostic_item ( sym:: IntoIterator , trait_predicate. trait_ref . def_id )
10871087 && 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 ( )
10891089 && ty. is_array ( )
10901090 && !msrv. meets ( msrvs:: ARRAY_INTO_ITERATOR )
10911091 {
10921092 return false ;
10931093 }
10941094
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 ) ;
10961096 let obligation = Obligation :: new ( cx. tcx , ObligationCause :: dummy ( ) , cx. param_env , predicate) ;
10971097 let infcx = cx. tcx . infer_ctxt ( ) . build ( ) ;
10981098 infcx. predicate_must_hold_modulo_regions ( & obligation)
@@ -1116,7 +1116,12 @@ fn has_ref_mut_self_method(cx: &LateContext<'_>, trait_def_id: DefId) -> bool {
11161116 . in_definition_order ( )
11171117 . any ( |assoc_item| {
11181118 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 ] ;
11201125 matches ! ( self_ty. kind( ) , ty:: Ref ( _, _, Mutability :: Mut ) )
11211126 } else {
11221127 false
@@ -1187,7 +1192,7 @@ fn referent_used_exactly_once<'tcx>(
11871192 }
11881193}
11891194
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
11911196// projected type that is a type parameter. Returns `false` if replacing the types would have an
11921197// effect on the function signature beyond substituting `new_ty` for `param_ty`.
11931198// See: https://github.com/rust-lang/rust-clippy/pull/9136#discussion_r927212757
@@ -1198,11 +1203,11 @@ fn replace_types<'tcx>(
11981203 fn_sig : FnSig < ' tcx > ,
11991204 arg_index : usize ,
12001205 projection_predicates : & [ ProjectionPredicate < ' tcx > ] ,
1201- substs : & mut [ ty:: GenericArg < ' tcx > ] ,
1206+ args : & mut [ ty:: GenericArg < ' tcx > ] ,
12021207) -> bool {
1203- let mut replaced = BitSet :: new_empty ( substs . len ( ) ) ;
1208+ let mut replaced = BitSet :: new_empty ( args . len ( ) ) ;
12041209
1205- let mut deque = VecDeque :: with_capacity ( substs . len ( ) ) ;
1210+ let mut deque = VecDeque :: with_capacity ( args . len ( ) ) ;
12061211 deque. push_back ( ( param_ty, new_ty) ) ;
12071212
12081213 while let Some ( ( param_ty, new_ty) ) = deque. pop_front ( ) {
@@ -1216,7 +1221,7 @@ fn replace_types<'tcx>(
12161221 return false ;
12171222 }
12181223
1219- substs [ param_ty. index as usize ] = ty:: GenericArg :: from ( new_ty) ;
1224+ args [ param_ty. index as usize ] = ty:: GenericArg :: from ( new_ty) ;
12201225
12211226 // The `replaced.insert(...)` check provides some protection against infinite loops.
12221227 if replaced. insert ( param_ty. index ) {
@@ -1231,7 +1236,7 @@ fn replace_types<'tcx>(
12311236 ) ) ;
12321237
12331238 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)
12351240 {
12361241 deque. push_back ( ( * term_param_ty, projected_ty) ) ;
12371242 }
0 commit comments