@@ -266,7 +266,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
266266 }
267267 }
268268
269- if self . param_env . caller_bounds ( ) . iter ( ) . any ( |c| {
269+ if self . infcx . param_env . caller_bounds ( ) . iter ( ) . any ( |c| {
270270 c. as_trait_clause ( ) . is_some_and ( |pred| {
271271 pred. skip_binder ( ) . self_ty ( ) == ty && self . infcx . tcx . is_fn_trait ( pred. def_id ( ) )
272272 } )
@@ -682,8 +682,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
682682 // Normalize before comparing to see through type aliases and projections.
683683 let old_ty = ty:: EarlyBinder :: bind ( ty) . instantiate ( tcx, generic_args) ;
684684 let new_ty = ty:: EarlyBinder :: bind ( ty) . instantiate ( tcx, new_args) ;
685- if let Ok ( old_ty) = tcx. try_normalize_erasing_regions ( self . param_env , old_ty)
686- && let Ok ( new_ty) = tcx. try_normalize_erasing_regions ( self . param_env , new_ty)
685+ if let Ok ( old_ty) = tcx. try_normalize_erasing_regions ( self . infcx . param_env , old_ty)
686+ && let Ok ( new_ty) =
687+ tcx. try_normalize_erasing_regions ( self . infcx . param_env , new_ty)
687688 {
688689 old_ty == new_ty
689690 } else {
@@ -715,7 +716,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
715716 self . infcx . predicate_must_hold_modulo_regions ( & Obligation :: new (
716717 tcx,
717718 ObligationCause :: dummy ( ) ,
718- self . param_env ,
719+ self . infcx . param_env ,
719720 ty:: EarlyBinder :: bind ( clause_for_ref) . instantiate ( tcx, generic_args) ,
720721 ) )
721722 } )
@@ -904,7 +905,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
904905 let ty = moved_place. ty ( self . body , self . infcx . tcx ) . ty ;
905906 debug ! ( "ty: {:?}, kind: {:?}" , ty, ty. kind( ) ) ;
906907
907- let Some ( assign_value) = self . infcx . err_ctxt ( ) . ty_kind_suggestion ( self . param_env , ty)
908+ let Some ( assign_value) = self . infcx . err_ctxt ( ) . ty_kind_suggestion ( self . infcx . param_env , ty)
908909 else {
909910 return ;
910911 } ;
@@ -1304,7 +1305,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
13041305 pub ( crate ) fn implements_clone ( & self , ty : Ty < ' tcx > ) -> bool {
13051306 let Some ( clone_trait_def) = self . infcx . tcx . lang_items ( ) . clone_trait ( ) else { return false } ;
13061307 self . infcx
1307- . type_implements_trait ( clone_trait_def, [ ty] , self . param_env )
1308+ . type_implements_trait ( clone_trait_def, [ ty] , self . infcx . param_env )
13081309 . must_apply_modulo_regions ( )
13091310 }
13101311
@@ -1437,7 +1438,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
14371438 let ocx = ObligationCtxt :: new_with_diagnostics ( self . infcx ) ;
14381439 let cause = ObligationCause :: misc ( span, self . mir_def_id ( ) ) ;
14391440
1440- ocx. register_bound ( cause, self . param_env , ty, def_id) ;
1441+ ocx. register_bound ( cause, self . infcx . param_env , ty, def_id) ;
14411442 let errors = ocx. select_all_or_error ( ) ;
14421443
14431444 // Only emit suggestion if all required predicates are on generic
@@ -1957,7 +1958,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
19571958 && let ty:: Ref ( _, inner, _) = rcvr_ty. kind ( )
19581959 && let inner = inner. peel_refs ( )
19591960 && ( Holds { ty : inner } ) . visit_ty ( local_ty) . is_break ( )
1960- && let None = self . infcx . type_implements_trait_shallow ( clone, inner, self . param_env )
1961+ && let None =
1962+ self . infcx . type_implements_trait_shallow ( clone, inner, self . infcx . param_env )
19611963 {
19621964 err. span_label (
19631965 span,
@@ -1989,7 +1991,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
19891991 let obligation = Obligation :: new (
19901992 self . infcx . tcx ,
19911993 ObligationCause :: dummy ( ) ,
1992- self . param_env ,
1994+ self . infcx . param_env ,
19931995 trait_ref,
19941996 ) ;
19951997 self . infcx . err_ctxt ( ) . suggest_derive (
@@ -3398,7 +3400,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
33983400 if let Some ( iter_trait) = tcx. get_diagnostic_item ( sym:: Iterator )
33993401 && self
34003402 . infcx
3401- . type_implements_trait ( iter_trait, [ return_ty] , self . param_env )
3403+ . type_implements_trait ( iter_trait, [ return_ty] , self . infcx . param_env )
34023404 . must_apply_modulo_regions ( )
34033405 {
34043406 err. span_suggestion_hidden (
@@ -3837,11 +3839,11 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
38373839 if tcx. is_diagnostic_item ( sym:: deref_method, method_did) {
38383840 let deref_target =
38393841 tcx. get_diagnostic_item ( sym:: deref_target) . and_then ( |deref_target| {
3840- Instance :: try_resolve ( tcx, self . param_env , deref_target, method_args)
3842+ Instance :: try_resolve ( tcx, self . infcx . param_env , deref_target, method_args)
38413843 . transpose ( )
38423844 } ) ;
38433845 if let Some ( Ok ( instance) ) = deref_target {
3844- let deref_target_ty = instance. ty ( tcx, self . param_env ) ;
3846+ let deref_target_ty = instance. ty ( tcx, self . infcx . param_env ) ;
38453847 err. note ( format ! ( "borrow occurs due to deref coercion to `{deref_target_ty}`" ) ) ;
38463848 err. span_note ( tcx. def_span ( instance. def_id ( ) ) , "deref defined here" ) ;
38473849 }
0 commit comments