@@ -25,6 +25,9 @@ pub struct EvalContext<'a, 'tcx: 'a, M: Machine<'tcx>> {
25
25
/// The results of the type checker, from rustc.
26
26
pub tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
27
27
28
+ /// Bounds in scope for polymorphic evaluations.
29
+ pub param_env : ty:: ParamEnv < ' tcx > ,
30
+
28
31
/// The virtual memory system.
29
32
pub memory : Memory < ' a , ' tcx , M > ,
30
33
@@ -194,7 +197,7 @@ impl<'a, 'tcx, M: Machine<'tcx>> LayoutOf<Ty<'tcx>> for &'a EvalContext<'a, 'tcx
194
197
type TyLayout = EvalResult < ' tcx , TyLayout < ' tcx > > ;
195
198
196
199
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)
198
201
. map_err ( |layout| EvalErrorKind :: Layout ( layout) . into ( ) )
199
202
}
200
203
}
@@ -212,13 +215,15 @@ impl<'c, 'b, 'a, 'tcx, M: Machine<'tcx>> LayoutOf<Ty<'tcx>>
212
215
impl < ' a , ' tcx , M : Machine < ' tcx > > EvalContext < ' a , ' tcx , M > {
213
216
pub fn new (
214
217
tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
218
+ param_env : ty:: ParamEnv < ' tcx > ,
215
219
limits : ResourceLimits ,
216
220
machine_data : M :: Data ,
217
221
memory_data : M :: MemoryData ,
218
222
) -> Self {
219
223
EvalContext {
220
224
machine_data,
221
225
tcx,
226
+ param_env,
222
227
memory : Memory :: new ( tcx, limits. memory_size , memory_data) ,
223
228
suspended : HashMap :: new ( ) ,
224
229
stack : Vec :: new ( ) ,
@@ -302,14 +307,14 @@ impl<'a, 'tcx, M: Machine<'tcx>> EvalContext<'a, 'tcx, M> {
302
307
let substs = self . tcx . trans_apply_param_substs ( self . substs ( ) , & substs) ;
303
308
ty:: Instance :: resolve (
304
309
self . tcx ,
305
- M :: param_env ( self ) ,
310
+ self . param_env ,
306
311
def_id,
307
312
substs,
308
313
) . ok_or ( EvalErrorKind :: TypeckError . into ( ) ) // turn error prop into a panic to expose associated type in const issue
309
314
}
310
315
311
316
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 )
313
318
}
314
319
315
320
pub fn load_mir (
0 commit comments