@@ -22,7 +22,7 @@ use rustc_infer::infer::{
22
22
} ;
23
23
use rustc_middle:: hir:: place:: PlaceBase ;
24
24
use rustc_middle:: mir:: { ConstraintCategory , ReturnConstraint } ;
25
- use rustc_middle:: ty:: subst :: InternalSubsts ;
25
+ use rustc_middle:: ty:: GenericArgs ;
26
26
use rustc_middle:: ty:: TypeVisitor ;
27
27
use rustc_middle:: ty:: { self , RegionVid , Ty } ;
28
28
use rustc_middle:: ty:: { Region , TyCtxt } ;
@@ -183,9 +183,9 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
183
183
fn is_closure_fn_mut ( & self , fr : RegionVid ) -> bool {
184
184
if let Some ( ty:: ReFree ( free_region) ) = self . to_error_region ( fr) . as_deref ( )
185
185
&& let ty:: BoundRegionKind :: BrEnv = free_region. bound_region
186
- && let DefiningTy :: Closure ( _, substs ) = self . regioncx . universal_regions ( ) . defining_ty
186
+ && let DefiningTy :: Closure ( _, args ) = self . regioncx . universal_regions ( ) . defining_ty
187
187
{
188
- return substs . as_closure ( ) . kind ( ) == ty:: ClosureKind :: FnMut ;
188
+ return args . as_closure ( ) . kind ( ) == ty:: ClosureKind :: FnMut ;
189
189
}
190
190
191
191
false
@@ -502,12 +502,12 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
502
502
. to_string ( ) ,
503
503
)
504
504
}
505
- ty:: Adt ( adt, substs ) => {
506
- let generic_arg = substs [ param_index as usize ] ;
507
- let identity_substs =
508
- InternalSubsts :: identity_for_item ( self . infcx . tcx , adt. did ( ) ) ;
509
- let base_ty = Ty :: new_adt ( self . infcx . tcx , * adt, identity_substs ) ;
510
- let base_generic_arg = identity_substs [ param_index as usize ] ;
505
+ ty:: Adt ( adt, args ) => {
506
+ let generic_arg = args [ param_index as usize ] ;
507
+ let identity_args =
508
+ GenericArgs :: identity_for_item ( self . infcx . tcx , adt. did ( ) ) ;
509
+ let base_ty = Ty :: new_adt ( self . infcx . tcx , * adt, identity_args ) ;
510
+ let base_generic_arg = identity_args [ param_index as usize ] ;
511
511
let adt_desc = adt. descr ( ) ;
512
512
513
513
let desc = format ! (
@@ -520,12 +520,11 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
520
520
}
521
521
ty:: FnDef ( def_id, _) => {
522
522
let name = self . infcx . tcx . item_name ( * def_id) ;
523
- let identity_substs =
524
- InternalSubsts :: identity_for_item ( self . infcx . tcx , * def_id) ;
523
+ let identity_args = GenericArgs :: identity_for_item ( self . infcx . tcx , * def_id) ;
525
524
let desc = format ! ( "a function pointer to `{name}`" ) ;
526
525
let note = format ! (
527
526
"the function `{name}` is invariant over the parameter `{}`" ,
528
- identity_substs [ param_index as usize ]
527
+ identity_args [ param_index as usize ]
529
528
) ;
530
529
( desc, note)
531
530
}
@@ -573,7 +572,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
573
572
574
573
let mut output_ty = self . regioncx . universal_regions ( ) . unnormalized_output_ty ;
575
574
if let ty:: Alias ( ty:: Opaque , ty:: AliasTy { def_id, .. } ) = * output_ty. kind ( ) {
576
- output_ty = self . infcx . tcx . type_of ( def_id) . subst_identity ( )
575
+ output_ty = self . infcx . tcx . type_of ( def_id) . instantiate_identity ( )
577
576
} ;
578
577
579
578
debug ! ( "report_fnmut_error: output_ty={:?}" , output_ty) ;
@@ -899,14 +898,14 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
899
898
let tcx = self . infcx . tcx ;
900
899
901
900
let instance = if let ConstraintCategory :: CallArgument ( Some ( func_ty) ) = category {
902
- let ( fn_did, substs ) = match func_ty. kind ( ) {
903
- ty:: FnDef ( fn_did, substs ) => ( fn_did, substs ) ,
901
+ let ( fn_did, args ) = match func_ty. kind ( ) {
902
+ ty:: FnDef ( fn_did, args ) => ( fn_did, args ) ,
904
903
_ => return ,
905
904
} ;
906
- debug ! ( ?fn_did, ?substs ) ;
905
+ debug ! ( ?fn_did, ?args ) ;
907
906
908
907
// Only suggest this on function calls, not closures
909
- let ty = tcx. type_of ( fn_did) . subst_identity ( ) ;
908
+ let ty = tcx. type_of ( fn_did) . instantiate_identity ( ) ;
910
909
debug ! ( "ty: {:?}, ty.kind: {:?}" , ty, ty. kind( ) ) ;
911
910
if let ty:: Closure ( _, _) = ty. kind ( ) {
912
911
return ;
@@ -916,7 +915,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
916
915
tcx,
917
916
self . param_env ,
918
917
* fn_did,
919
- self . infcx . resolve_vars_if_possible ( substs ) ,
918
+ self . infcx . resolve_vars_if_possible ( args ) ,
920
919
) {
921
920
instance
922
921
} else {
0 commit comments