Skip to content

Commit 84b0073

Browse files
committed
Remove an argument that can be computed cheaply
1 parent cec8769 commit 84b0073

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> {
@@ -346,24 +346,20 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
346346
// so we have to reject reading mutable global memory.
347347
CompileTimeInterpreter::new(CanAccessMutGlobal::from(is_static), CheckAlignment::Error),
348348
);
349-
eval_in_interpreter(ecx, cid, is_static)
349+
eval_in_interpreter(ecx, cid)
350350
}
351351

352352
fn eval_in_interpreter<'mir, 'tcx, R: InterpretationResult<'tcx>>(
353353
mut ecx: InterpCx<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>>,
354354
cid: GlobalId<'tcx>,
355-
is_static: bool,
356355
) -> 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-
360356
let res = ecx.load_mir(cid.instance.def, cid.promoted);
361357
match res.and_then(|body| eval_body_using_ecx(&mut ecx, cid, body)) {
362358
Err(error) => {
363359
let (error, backtrace) = error.into_parts();
364360
backtrace.print_backtrace();
365361

366-
let (kind, instance) = if is_static {
362+
let (kind, instance) = if ecx.tcx.is_static(cid.instance.def_id()) {
367363
("static", String::new())
368364
} else {
369365
// If the current item has generics, we'd like to enrich the message with the

0 commit comments

Comments
 (0)