@@ -10,7 +10,7 @@ use rustc_hir as hir;
1010use rustc_hir:: def:: { CtorKind , Namespace } ;
1111use rustc_hir:: GeneratorKind ;
1212use rustc_index:: vec:: IndexSlice ;
13- use rustc_infer:: infer:: { LateBoundRegionConversionTime , TyCtxtInferExt } ;
13+ use rustc_infer:: infer:: LateBoundRegionConversionTime ;
1414use rustc_middle:: mir:: tcx:: PlaceTy ;
1515use rustc_middle:: mir:: {
1616 AggregateKind , Constant , FakeReadCause , Local , LocalInfo , LocalKind , Location , Operand , Place ,
@@ -1042,15 +1042,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
10421042 if let Some ( ( CallDesugaringKind :: ForLoopIntoIter , _) ) = desugaring {
10431043 let ty = moved_place. ty ( self . body , tcx) . ty ;
10441044 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+ ) ,
10541051 _ => false ,
10551052 } ;
10561053 if suggest {
@@ -1094,20 +1091,18 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
10941091 is_partial,
10951092 is_loop_message,
10961093 } ) ;
1097- let infcx = tcx. infer_ctxt ( ) . build ( ) ;
10981094 // 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 ;
11011096
11021097 if let ty:: Adt ( def, substs) = ty. kind ( )
11031098 && Some ( def. did ( ) ) == tcx. lang_items ( ) . pin_type ( )
11041099 && 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 (
11061101 fn_call_span,
11071102 LateBoundRegionConversionTime :: FnCall ,
11081103 tcx. fn_sig ( method_did) . subst ( tcx, method_substs) . input ( 0 ) ,
11091104 )
1110- && infcx. can_eq ( self . param_env , ty, self_ty)
1105+ && self . infcx . can_eq ( self . param_env , ty, self_ty)
11111106 {
11121107 err. eager_subdiagnostic (
11131108 & self . infcx . tcx . sess . parse_sess . span_diagnostic ,
@@ -1123,7 +1118,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
11231118 self . param_env ,
11241119 ty:: Binder :: dummy ( trait_ref) ,
11251120 )
1126- && infcx. predicate_must_hold_modulo_regions ( & o)
1121+ && self . infcx . predicate_must_hold_modulo_regions ( & o)
11271122 {
11281123 err. span_suggestion_verbose (
11291124 fn_call_span. shrink_to_lo ( ) ,
0 commit comments