Skip to content

Commit

Permalink
Rollup merge of #122654 - RalfJung:interpret-comment, r=matthiaskrgr
Browse files Browse the repository at this point in the history
interpret/memory: explain why we use == on bool

This came up in #122636.
  • Loading branch information
matthiaskrgr committed Mar 18, 2024
2 parents d9b47c1 + 872781b commit 86bb0bc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions compiler/rustc_const_eval/src/interpret/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
/// Runs the close in "validation" mode, which means the machine's memory read hooks will be
/// suppressed. Needless to say, this must only be set with great care! Cannot be nested.
pub(super) fn run_for_validation<R>(&self, f: impl FnOnce() -> R) -> R {
// This deliberately uses `==` on `bool` to follow the pattern
// `assert!(val.replace(new) == old)`.
assert!(
self.memory.validation_in_progress.replace(true) == false,
"`validation_in_progress` was already set"
Expand Down

0 comments on commit 86bb0bc

Please sign in to comment.