Skip to content

Commit 86bb0bc

Browse files
authored
Rollup merge of #122654 - RalfJung:interpret-comment, r=matthiaskrgr
interpret/memory: explain why we use == on bool This came up in #122636.
2 parents d9b47c1 + 872781b commit 86bb0bc

File tree

1 file changed

+2
-0
lines changed
  • compiler/rustc_const_eval/src/interpret

1 file changed

+2
-0
lines changed

compiler/rustc_const_eval/src/interpret/memory.rs

+2
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
949949
/// Runs the close in "validation" mode, which means the machine's memory read hooks will be
950950
/// suppressed. Needless to say, this must only be set with great care! Cannot be nested.
951951
pub(super) fn run_for_validation<R>(&self, f: impl FnOnce() -> R) -> R {
952+
// This deliberately uses `==` on `bool` to follow the pattern
953+
// `assert!(val.replace(new) == old)`.
952954
assert!(
953955
self.memory.validation_in_progress.replace(true) == false,
954956
"`validation_in_progress` was already set"

0 commit comments

Comments
 (0)