Skip to content

Commit 44406ae

Browse files
committed
Improve comments.
1 parent 25703eb commit 44406ae

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

compiler/rustc_const_eval/src/const_eval/dummy_machine.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ impl<'tcx> interpret::Machine<'tcx> for DummyMachine {
124124

125125
#[inline(always)]
126126
fn runtime_checks(_ecx: &InterpCx<'tcx, Self>, r: RuntimeChecks) -> InterpResult<'tcx, bool> {
127-
// We can't look at `tcx.sess` here as that can differ across crates, which can lead to
128-
// unsound differences in evaluating the same constant at different instantiation sites.
127+
// Runtime checks have different value depending on the crate they are codegenned in.
128+
// Verify we aren't trying to evaluate them in mir-optimizations.
129129
panic!("compiletime machine evaluated {r:?}")
130130
}
131131

compiler/rustc_middle/src/mir/statement.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,7 @@ impl<'tcx> Operand<'tcx> {
694694
local_decls.local_decls()[l.local].source_info.span
695695
}
696696
Operand::Constant(c) => c.span,
697+
// User code should not contain this operand, so we should not need this span.
697698
Operand::RuntimeChecks(_) => DUMMY_SP,
698699
}
699700
}

compiler/rustc_middle/src/mir/syntax.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,8 +1328,8 @@ pub enum Operand<'tcx> {
13281328
/// Constants are already semantically values, and remain unchanged.
13291329
Constant(Box<ConstOperand<'tcx>>),
13301330

1331-
/// Special constants whose value depends on the evaluation context. Their value depends on a
1332-
/// flag on the crate being codegenned.
1331+
/// Query the compilation session of the current crate for a particular flag. This is not quite
1332+
/// a const since its value can differ across crates within a single crate graph.
13331333
RuntimeChecks(RuntimeChecks),
13341334
}
13351335

0 commit comments

Comments
 (0)