@@ -290,7 +290,7 @@ pub fn eval_static_initializer_provider<'tcx>(
290
290
// they do not have to behave "as if" they were evaluated at runtime.
291
291
CompileTimeInterpreter :: new ( CanAccessMutGlobal :: Yes , CheckAlignment :: Error ) ,
292
292
) ;
293
- eval_in_interpreter ( ecx, cid, true )
293
+ eval_in_interpreter ( ecx, cid)
294
294
}
295
295
296
296
pub trait InterpretationResult < ' tcx > {
@@ -346,24 +346,20 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
346
346
// so we have to reject reading mutable global memory.
347
347
CompileTimeInterpreter :: new ( CanAccessMutGlobal :: from ( is_static) , CheckAlignment :: Error ) ,
348
348
) ;
349
- eval_in_interpreter ( ecx, cid, is_static )
349
+ eval_in_interpreter ( ecx, cid)
350
350
}
351
351
352
352
fn eval_in_interpreter < ' mir , ' tcx , R : InterpretationResult < ' tcx > > (
353
353
mut ecx : InterpCx < ' mir , ' tcx , CompileTimeInterpreter < ' mir , ' tcx > > ,
354
354
cid : GlobalId < ' tcx > ,
355
- is_static : bool ,
356
355
) -> Result < R , ErrorHandled > {
357
- // `is_static` just means "in static", it could still be a promoted!
358
- debug_assert_eq ! ( is_static, ecx. tcx. static_mutability( cid. instance. def_id( ) ) . is_some( ) ) ;
359
-
360
356
let res = ecx. load_mir ( cid. instance . def , cid. promoted ) ;
361
357
match res. and_then ( |body| eval_body_using_ecx ( & mut ecx, cid, body) ) {
362
358
Err ( error) => {
363
359
let ( error, backtrace) = error. into_parts ( ) ;
364
360
backtrace. print_backtrace ( ) ;
365
361
366
- let ( kind, instance) = if is_static {
362
+ let ( kind, instance) = if ecx . tcx . is_static ( cid . instance . def_id ( ) ) {
367
363
( "static" , String :: new ( ) )
368
364
} else {
369
365
// If the current item has generics, we'd like to enrich the message with the
0 commit comments