@@ -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 {
@@ -703,13 +704,15 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
703704 // Test the callee's predicates, substituting in `ref_ty` for the moved argument type.
704705 clauses. instantiate ( tcx, new_args) . predicates . iter ( ) . all ( |& ( mut clause) | {
705706 // Normalize before testing to see through type aliases and projections.
706- if let Ok ( normalized) = tcx. try_normalize_erasing_regions ( self . param_env , clause) {
707+ if let Ok ( normalized) =
708+ tcx. try_normalize_erasing_regions ( self . infcx . param_env , clause)
709+ {
707710 clause = normalized;
708711 }
709712 self . infcx . predicate_must_hold_modulo_regions ( & Obligation :: new (
710713 tcx,
711714 ObligationCause :: dummy ( ) ,
712- self . param_env ,
715+ self . infcx . param_env ,
713716 clause,
714717 ) )
715718 } )
@@ -898,7 +901,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
898901 let ty = moved_place. ty ( self . body , self . infcx . tcx ) . ty ;
899902 debug ! ( "ty: {:?}, kind: {:?}" , ty, ty. kind( ) ) ;
900903
901- let Some ( assign_value) = self . infcx . err_ctxt ( ) . ty_kind_suggestion ( self . param_env , ty)
904+ let Some ( assign_value) = self . infcx . err_ctxt ( ) . ty_kind_suggestion ( self . infcx . param_env , ty)
902905 else {
903906 return ;
904907 } ;
@@ -1298,7 +1301,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
12981301 pub ( crate ) fn implements_clone ( & self , ty : Ty < ' tcx > ) -> bool {
12991302 let Some ( clone_trait_def) = self . infcx . tcx . lang_items ( ) . clone_trait ( ) else { return false } ;
13001303 self . infcx
1301- . type_implements_trait ( clone_trait_def, [ ty] , self . param_env )
1304+ . type_implements_trait ( clone_trait_def, [ ty] , self . infcx . param_env )
13021305 . must_apply_modulo_regions ( )
13031306 }
13041307
@@ -1431,7 +1434,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
14311434 let ocx = ObligationCtxt :: new_with_diagnostics ( self . infcx ) ;
14321435 let cause = ObligationCause :: misc ( span, self . mir_def_id ( ) ) ;
14331436
1434- ocx. register_bound ( cause, self . param_env , ty, def_id) ;
1437+ ocx. register_bound ( cause, self . infcx . param_env , ty, def_id) ;
14351438 let errors = ocx. select_all_or_error ( ) ;
14361439
14371440 // Only emit suggestion if all required predicates are on generic
@@ -1951,7 +1954,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
19511954 && let ty:: Ref ( _, inner, _) = rcvr_ty. kind ( )
19521955 && let inner = inner. peel_refs ( )
19531956 && ( Holds { ty : inner } ) . visit_ty ( local_ty) . is_break ( )
1954- && let None = self . infcx . type_implements_trait_shallow ( clone, inner, self . param_env )
1957+ && let None =
1958+ self . infcx . type_implements_trait_shallow ( clone, inner, self . infcx . param_env )
19551959 {
19561960 err. span_label (
19571961 span,
@@ -1983,7 +1987,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
19831987 let obligation = Obligation :: new (
19841988 self . infcx . tcx ,
19851989 ObligationCause :: dummy ( ) ,
1986- self . param_env ,
1990+ self . infcx . param_env ,
19871991 trait_ref,
19881992 ) ;
19891993 self . infcx . err_ctxt ( ) . suggest_derive (
@@ -3392,7 +3396,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
33923396 if let Some ( iter_trait) = tcx. get_diagnostic_item ( sym:: Iterator )
33933397 && self
33943398 . infcx
3395- . type_implements_trait ( iter_trait, [ return_ty] , self . param_env )
3399+ . type_implements_trait ( iter_trait, [ return_ty] , self . infcx . param_env )
33963400 . must_apply_modulo_regions ( )
33973401 {
33983402 err. span_suggestion_hidden (
@@ -3831,11 +3835,11 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
38313835 if tcx. is_diagnostic_item ( sym:: deref_method, method_did) {
38323836 let deref_target =
38333837 tcx. get_diagnostic_item ( sym:: deref_target) . and_then ( |deref_target| {
3834- Instance :: try_resolve ( tcx, self . param_env , deref_target, method_args)
3838+ Instance :: try_resolve ( tcx, self . infcx . param_env , deref_target, method_args)
38353839 . transpose ( )
38363840 } ) ;
38373841 if let Some ( Ok ( instance) ) = deref_target {
3838- let deref_target_ty = instance. ty ( tcx, self . param_env ) ;
3842+ let deref_target_ty = instance. ty ( tcx, self . infcx . param_env ) ;
38393843 err. note ( format ! ( "borrow occurs due to deref coercion to `{deref_target_ty}`" ) ) ;
38403844 err. span_note ( tcx. def_span ( instance. def_id ( ) ) , "deref defined here" ) ;
38413845 }
0 commit comments