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