@@ -29,8 +29,8 @@ use crate::{
2929 db:: HirDatabase ,
3030 fold_generic_args, fold_tys_and_consts,
3131 next_solver:: {
32- self , ClauseKind , DbInterner , ErrorGuaranteed , ParamEnv , Predicate , PredicateKind ,
33- SolverDefIds , Term , TraitRef ,
32+ self , ClauseKind , DbInterner , ErrorGuaranteed , Predicate , PredicateKind , SolverDefIds ,
33+ Term , TraitRef ,
3434 fulfill:: FulfillmentCtxt ,
3535 infer:: {
3636 DbInternerInferExt , InferCtxt , InferOk ,
@@ -213,7 +213,6 @@ pub(crate) struct InferenceTable<'db> {
213213 pub ( crate ) db : & ' db dyn HirDatabase ,
214214 pub ( crate ) interner : DbInterner < ' db > ,
215215 pub ( crate ) trait_env : Arc < TraitEnvironment < ' db > > ,
216- pub ( crate ) param_env : ParamEnv < ' db > ,
217216 pub ( crate ) tait_coercion_table : Option < FxHashMap < OpaqueTyId , Ty > > ,
218217 pub ( crate ) infer_ctxt : InferCtxt < ' db > ,
219218 diverging_tys : FxHashSet < Ty > ,
@@ -235,7 +234,6 @@ impl<'db> InferenceTable<'db> {
235234 InferenceTable {
236235 db,
237236 interner,
238- param_env : trait_env. env . to_nextsolver ( interner) ,
239237 trait_env,
240238 tait_coercion_table : None ,
241239 fulfillment_cx : FulfillmentCtxt :: new ( & infer_ctxt) ,
@@ -426,7 +424,7 @@ impl<'db> InferenceTable<'db> {
426424 {
427425 let ty = self . resolve_vars_with_obligations ( ty) ;
428426 self . infer_ctxt
429- . at ( & ObligationCause :: new ( ) , self . param_env )
427+ . at ( & ObligationCause :: new ( ) , self . trait_env . env )
430428 . deeply_normalize ( ty. clone ( ) )
431429 . unwrap_or ( ty)
432430 }
@@ -741,7 +739,7 @@ impl<'db> InferenceTable<'db> {
741739 ) -> InferResult < ' db , ( ) > {
742740 let variance = rustc_type_ir:: Variance :: Invariant ;
743741 let span = crate :: next_solver:: Span :: dummy ( ) ;
744- match self . infer_ctxt . relate ( self . param_env , lhs, variance, rhs, span) {
742+ match self . infer_ctxt . relate ( self . trait_env . env , lhs, variance, rhs, span) {
745743 Ok ( goals) => Ok ( crate :: infer:: InferOk { goals, value : ( ) } ) ,
746744 Err ( _) => Err ( TypeError ) ,
747745 }
@@ -798,7 +796,7 @@ impl<'db> InferenceTable<'db> {
798796
799797 fn structurally_normalize_term ( & mut self , term : Term < ' db > ) -> Term < ' db > {
800798 self . infer_ctxt
801- . at ( & ObligationCause :: new ( ) , self . param_env )
799+ . at ( & ObligationCause :: new ( ) , self . trait_env . env )
802800 . structurally_normalize_term ( term, & mut self . fulfillment_cx )
803801 . unwrap_or ( term)
804802 }
@@ -818,7 +816,7 @@ impl<'db> InferenceTable<'db> {
818816 // in a reentrant borrow, causing an ICE.
819817 let result = self
820818 . infer_ctxt
821- . at ( & ObligationCause :: misc ( ) , self . param_env )
819+ . at ( & ObligationCause :: misc ( ) , self . trait_env . env )
822820 . structurally_normalize_ty ( ty, & mut self . fulfillment_cx ) ;
823821 match result {
824822 Ok ( normalized_ty) => normalized_ty,
@@ -874,14 +872,14 @@ impl<'db> InferenceTable<'db> {
874872 /// choice (during e.g. method resolution or deref).
875873 #[ tracing:: instrument( level = "debug" , skip( self ) ) ]
876874 pub ( crate ) fn try_obligation ( & mut self , predicate : Predicate < ' db > ) -> NextTraitSolveResult {
877- let goal = next_solver:: Goal { param_env : self . param_env , predicate } ;
875+ let goal = next_solver:: Goal { param_env : self . trait_env . env , predicate } ;
878876 let canonicalized = self . canonicalize ( goal) ;
879877
880878 next_trait_solve_canonical_in_ctxt ( & self . infer_ctxt , canonicalized)
881879 }
882880
883881 pub ( crate ) fn register_obligation ( & mut self , predicate : Predicate < ' db > ) {
884- let goal = next_solver:: Goal { param_env : self . param_env , predicate } ;
882+ let goal = next_solver:: Goal { param_env : self . trait_env . env , predicate } ;
885883 self . register_obligation_in_env ( goal)
886884 }
887885
0 commit comments