@@ -25,6 +25,9 @@ pub struct EvalContext<'a, 'tcx: 'a, M: Machine<'tcx>> {
2525 /// The results of the type checker, from rustc.
2626 pub tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
2727
28+ /// Bounds in scope for polymorphic evaluations.
29+ pub param_env : ty:: ParamEnv < ' tcx > ,
30+
2831 /// The virtual memory system.
2932 pub memory : Memory < ' a , ' tcx , M > ,
3033
@@ -194,7 +197,7 @@ impl<'a, 'tcx, M: Machine<'tcx>> LayoutOf<Ty<'tcx>> for &'a EvalContext<'a, 'tcx
194197 type TyLayout = EvalResult < ' tcx , TyLayout < ' tcx > > ;
195198
196199 fn layout_of ( self , ty : Ty < ' tcx > ) -> Self :: TyLayout {
197- ( self . tcx , M :: param_env ( self ) ) . layout_of ( ty)
200+ ( self . tcx , self . param_env ) . layout_of ( ty)
198201 . map_err ( |layout| EvalErrorKind :: Layout ( layout) . into ( ) )
199202 }
200203}
@@ -212,13 +215,15 @@ impl<'c, 'b, 'a, 'tcx, M: Machine<'tcx>> LayoutOf<Ty<'tcx>>
212215impl < ' a , ' tcx , M : Machine < ' tcx > > EvalContext < ' a , ' tcx , M > {
213216 pub fn new (
214217 tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
218+ param_env : ty:: ParamEnv < ' tcx > ,
215219 limits : ResourceLimits ,
216220 machine_data : M :: Data ,
217221 memory_data : M :: MemoryData ,
218222 ) -> Self {
219223 EvalContext {
220224 machine_data,
221225 tcx,
226+ param_env,
222227 memory : Memory :: new ( tcx, limits. memory_size , memory_data) ,
223228 suspended : HashMap :: new ( ) ,
224229 stack : Vec :: new ( ) ,
@@ -302,14 +307,14 @@ impl<'a, 'tcx, M: Machine<'tcx>> EvalContext<'a, 'tcx, M> {
302307 let substs = self . tcx . trans_apply_param_substs ( self . substs ( ) , & substs) ;
303308 ty:: Instance :: resolve (
304309 self . tcx ,
305- M :: param_env ( self ) ,
310+ self . param_env ,
306311 def_id,
307312 substs,
308313 ) . ok_or ( EvalErrorKind :: TypeckError . into ( ) ) // turn error prop into a panic to expose associated type in const issue
309314 }
310315
311316 pub ( super ) fn type_is_sized ( & self , ty : Ty < ' tcx > ) -> bool {
312- ty. is_sized ( self . tcx , M :: param_env ( self ) , DUMMY_SP )
317+ ty. is_sized ( self . tcx , self . param_env , DUMMY_SP )
313318 }
314319
315320 pub fn load_mir (
0 commit comments