Skip to content

Commit

Permalink
Rollup merge of rust-lang#122654 - RalfJung:interpret-comment, r=matt…
Browse files Browse the repository at this point in the history
…hiaskrgr

interpret/memory: explain why we use == on bool

This came up in rust-lang#122636.
  • Loading branch information
matthiaskrgr committed Mar 17, 2024
2 parents 36006b2 + 872781b commit 1139bc5
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 1139bc5

Please sign in to comment.