Skip to content

Commit 612febc

Browse files
committed
explain why we can use raw
1 parent c462e44 commit 612febc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/librustc_mir/interpret/eval_context.rs

+4
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,10 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc
597597
} else {
598598
self.param_env
599599
};
600+
// We use `const_eval_raw` here, and get an unvalidated result. That is okay:
601+
// Our result will later be validated anyway, and there seems no good reason
602+
// to have to fail early here. This is also more consistent with
603+
// `Memory::get_static_alloc` which has to use `const_eval_raw` to avoid cycles.
600604
let val = self.tcx.const_eval_raw(param_env.and(gid)).map_err(|err| {
601605
match err {
602606
ErrorHandled::Reported => EvalErrorKind::ReferencedConstant,

0 commit comments

Comments
 (0)