@@ -285,15 +285,22 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
285
285
let def = cid. instance . def . def_id ( ) ;
286
286
let is_static = tcx. is_static ( def) ;
287
287
288
- let mut ecx = InterpCx :: new (
288
+ let ecx = InterpCx :: new (
289
289
tcx,
290
290
tcx. def_span ( def) ,
291
291
key. param_env ,
292
292
// Statics (and promoteds inside statics) may access other statics, because unlike consts
293
293
// they do not have to behave "as if" they were evaluated at runtime.
294
294
CompileTimeInterpreter :: new ( CanAccessStatics :: from ( is_static) , CheckAlignment :: Error ) ,
295
295
) ;
296
+ eval_in_interpreter ( ecx, cid, is_static)
297
+ }
296
298
299
+ pub fn eval_in_interpreter < ' mir , ' tcx > (
300
+ mut ecx : InterpCx < ' mir , ' tcx , CompileTimeInterpreter < ' mir , ' tcx > > ,
301
+ cid : GlobalId < ' tcx > ,
302
+ is_static : bool ,
303
+ ) -> :: rustc_middle:: mir:: interpret:: EvalToAllocationRawResult < ' tcx > {
297
304
let res = ecx. load_mir ( cid. instance . def , cid. promoted ) ;
298
305
match res. and_then ( |body| eval_body_using_ecx ( & mut ecx, cid, & body) ) {
299
306
Err ( error) => {
@@ -306,7 +313,7 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
306
313
// If the current item has generics, we'd like to enrich the message with the
307
314
// instance and its args: to show the actual compile-time values, in addition to
308
315
// the expression, leading to the const eval error.
309
- let instance = & key . value . instance ;
316
+ let instance = & cid . instance ;
310
317
if !instance. args . is_empty ( ) {
311
318
let instance = with_no_trimmed_paths ! ( instance. to_string( ) ) ;
312
319
( "const_with_path" , instance)
0 commit comments