@@ -266,7 +266,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
266
266
}
267
267
}
268
268
269
- if self . param_env . caller_bounds ( ) . iter ( ) . any ( |c| {
269
+ if self . infcx . param_env . caller_bounds ( ) . iter ( ) . any ( |c| {
270
270
c. as_trait_clause ( ) . is_some_and ( |pred| {
271
271
pred. skip_binder ( ) . self_ty ( ) == ty && self . infcx . tcx . is_fn_trait ( pred. def_id ( ) )
272
272
} )
@@ -682,8 +682,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
682
682
// Normalize before comparing to see through type aliases and projections.
683
683
let old_ty = ty:: EarlyBinder :: bind ( ty) . instantiate ( tcx, generic_args) ;
684
684
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)
687
688
{
688
689
old_ty == new_ty
689
690
} else {
@@ -703,13 +704,15 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
703
704
// Test the callee's predicates, substituting in `ref_ty` for the moved argument type.
704
705
clauses. instantiate ( tcx, new_args) . predicates . iter ( ) . all ( |& ( mut clause) | {
705
706
// 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
+ {
707
710
clause = normalized;
708
711
}
709
712
self . infcx . predicate_must_hold_modulo_regions ( & Obligation :: new (
710
713
tcx,
711
714
ObligationCause :: dummy ( ) ,
712
- self . param_env ,
715
+ self . infcx . param_env ,
713
716
clause,
714
717
) )
715
718
} )
@@ -898,7 +901,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
898
901
let ty = moved_place. ty ( self . body , self . infcx . tcx ) . ty ;
899
902
debug ! ( "ty: {:?}, kind: {:?}" , ty, ty. kind( ) ) ;
900
903
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)
902
905
else {
903
906
return ;
904
907
} ;
@@ -1298,7 +1301,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
1298
1301
pub ( crate ) fn implements_clone ( & self , ty : Ty < ' tcx > ) -> bool {
1299
1302
let Some ( clone_trait_def) = self . infcx . tcx . lang_items ( ) . clone_trait ( ) else { return false } ;
1300
1303
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 )
1302
1305
. must_apply_modulo_regions ( )
1303
1306
}
1304
1307
@@ -1431,7 +1434,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
1431
1434
let ocx = ObligationCtxt :: new_with_diagnostics ( self . infcx ) ;
1432
1435
let cause = ObligationCause :: misc ( span, self . mir_def_id ( ) ) ;
1433
1436
1434
- ocx. register_bound ( cause, self . param_env , ty, def_id) ;
1437
+ ocx. register_bound ( cause, self . infcx . param_env , ty, def_id) ;
1435
1438
let errors = ocx. select_all_or_error ( ) ;
1436
1439
1437
1440
// Only emit suggestion if all required predicates are on generic
@@ -1951,7 +1954,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
1951
1954
&& let ty:: Ref ( _, inner, _) = rcvr_ty. kind ( )
1952
1955
&& let inner = inner. peel_refs ( )
1953
1956
&& ( 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 )
1955
1959
{
1956
1960
err. span_label (
1957
1961
span,
@@ -1983,7 +1987,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
1983
1987
let obligation = Obligation :: new (
1984
1988
self . infcx . tcx ,
1985
1989
ObligationCause :: dummy ( ) ,
1986
- self . param_env ,
1990
+ self . infcx . param_env ,
1987
1991
trait_ref,
1988
1992
) ;
1989
1993
self . infcx . err_ctxt ( ) . suggest_derive (
@@ -3392,7 +3396,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
3392
3396
if let Some ( iter_trait) = tcx. get_diagnostic_item ( sym:: Iterator )
3393
3397
&& self
3394
3398
. infcx
3395
- . type_implements_trait ( iter_trait, [ return_ty] , self . param_env )
3399
+ . type_implements_trait ( iter_trait, [ return_ty] , self . infcx . param_env )
3396
3400
. must_apply_modulo_regions ( )
3397
3401
{
3398
3402
err. span_suggestion_hidden (
@@ -3831,11 +3835,11 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
3831
3835
if tcx. is_diagnostic_item ( sym:: deref_method, method_did) {
3832
3836
let deref_target =
3833
3837
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)
3835
3839
. transpose ( )
3836
3840
} ) ;
3837
3841
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 ) ;
3839
3843
err. note ( format ! ( "borrow occurs due to deref coercion to `{deref_target_ty}`" ) ) ;
3840
3844
err. span_note ( tcx. def_span ( instance. def_id ( ) ) , "deref defined here" ) ;
3841
3845
}
0 commit comments