Skip to content

Commit 02a0ac8

Browse files
committed
Remove an argument that can be computed cheaply
1 parent d3b7b55 commit 02a0ac8

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

compiler/rustc_const_eval/src/const_eval/eval_queries.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ pub fn eval_static_initializer_provider<'tcx>(
290290
// they do not have to behave "as if" they were evaluated at runtime.
291291
CompileTimeInterpreter::new(CanAccessMutGlobal::Yes, CheckAlignment::Error),
292292
);
293-
eval_in_interpreter(ecx, cid, true)
293+
eval_in_interpreter(ecx, cid)
294294
}
295295

296296
pub trait InterpretationResult<'tcx> {
@@ -349,24 +349,20 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
349349
// so we have to reject reading mutable global memory.
350350
CompileTimeInterpreter::new(CanAccessMutGlobal::from(is_static), CheckAlignment::Error),
351351
);
352-
eval_in_interpreter(ecx, cid, is_static)
352+
eval_in_interpreter(ecx, cid)
353353
}
354354

355355
fn eval_in_interpreter<'mir, 'tcx, R: InterpretationResult<'tcx>>(
356356
mut ecx: InterpCx<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>>,
357357
cid: GlobalId<'tcx>,
358-
is_static: bool,
359358
) -> 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-
363359
let res = ecx.load_mir(cid.instance.def, cid.promoted);
364360
match res.and_then(|body| eval_body_using_ecx(&mut ecx, cid, body)) {
365361
Err(error) => {
366362
let (error, backtrace) = error.into_parts();
367363
backtrace.print_backtrace();
368364

369-
let (kind, instance) = if is_static {
365+
let (kind, instance) = if ecx.tcx.is_static(cid.instance.def_id()) {
370366
("static", String::new())
371367
} else {
372368
// If the current item has generics, we'd like to enrich the message with the

0 commit comments

Comments
 (0)