@@ -10,7 +10,7 @@ use rustc_hir as hir;
10
10
use rustc_hir:: def:: { CtorKind , Namespace } ;
11
11
use rustc_hir:: GeneratorKind ;
12
12
use rustc_index:: vec:: IndexSlice ;
13
- use rustc_infer:: infer:: { LateBoundRegionConversionTime , TyCtxtInferExt } ;
13
+ use rustc_infer:: infer:: LateBoundRegionConversionTime ;
14
14
use rustc_middle:: mir:: tcx:: PlaceTy ;
15
15
use rustc_middle:: mir:: {
16
16
AggregateKind , Constant , FakeReadCause , Local , LocalInfo , LocalKind , Location , Operand , Place ,
@@ -1042,15 +1042,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1042
1042
if let Some ( ( CallDesugaringKind :: ForLoopIntoIter , _) ) = desugaring {
1043
1043
let ty = moved_place. ty ( self . body , tcx) . ty ;
1044
1044
let suggest = match tcx. get_diagnostic_item ( sym:: IntoIterator ) {
1045
- Some ( def_id) => {
1046
- let infcx = self . infcx . tcx . infer_ctxt ( ) . build ( ) ;
1047
- type_known_to_meet_bound_modulo_regions (
1048
- & infcx,
1049
- self . param_env ,
1050
- tcx. mk_imm_ref ( tcx. lifetimes . re_erased , tcx. erase_regions ( ty) ) ,
1051
- def_id,
1052
- )
1053
- }
1045
+ Some ( def_id) => type_known_to_meet_bound_modulo_regions (
1046
+ & self . infcx ,
1047
+ self . param_env ,
1048
+ tcx. mk_imm_ref ( tcx. lifetimes . re_erased , ty) ,
1049
+ def_id,
1050
+ ) ,
1054
1051
_ => false ,
1055
1052
} ;
1056
1053
if suggest {
@@ -1094,20 +1091,18 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1094
1091
is_partial,
1095
1092
is_loop_message,
1096
1093
} ) ;
1097
- let infcx = tcx. infer_ctxt ( ) . build ( ) ;
1098
1094
// Erase and shadow everything that could be passed to the new infcx.
1099
- let ty = tcx. erase_regions ( moved_place. ty ( self . body , tcx) . ty ) ;
1100
- let method_substs = tcx. erase_regions ( method_substs) ;
1095
+ let ty = moved_place. ty ( self . body , tcx) . ty ;
1101
1096
1102
1097
if let ty:: Adt ( def, substs) = ty. kind ( )
1103
1098
&& Some ( def. did ( ) ) == tcx. lang_items ( ) . pin_type ( )
1104
1099
&& let ty:: Ref ( _, _, hir:: Mutability :: Mut ) = substs. type_at ( 0 ) . kind ( )
1105
- && let self_ty = infcx. instantiate_binder_with_fresh_vars (
1100
+ && let self_ty = self . infcx . instantiate_binder_with_fresh_vars (
1106
1101
fn_call_span,
1107
1102
LateBoundRegionConversionTime :: FnCall ,
1108
1103
tcx. fn_sig ( method_did) . subst ( tcx, method_substs) . input ( 0 ) ,
1109
1104
)
1110
- && infcx. can_eq ( self . param_env , ty, self_ty)
1105
+ && self . infcx . can_eq ( self . param_env , ty, self_ty)
1111
1106
{
1112
1107
err. eager_subdiagnostic (
1113
1108
& self . infcx . tcx . sess . parse_sess . span_diagnostic ,
@@ -1123,7 +1118,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1123
1118
self . param_env ,
1124
1119
ty:: Binder :: dummy ( trait_ref) ,
1125
1120
)
1126
- && infcx. predicate_must_hold_modulo_regions ( & o)
1121
+ && self . infcx . predicate_must_hold_modulo_regions ( & o)
1127
1122
{
1128
1123
err. span_suggestion_verbose (
1129
1124
fn_call_span. shrink_to_lo ( ) ,
0 commit comments