Skip to content

Commit

Permalink
Unrolled build for rust-lang#122654
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#122654 - RalfJung:interpret-comment, r=matthiaskrgr

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

This came up in rust-lang#122636.
  • Loading branch information
rust-timer committed Mar 18, 2024
2 parents 80e5694 + 872781b commit e1aaf77
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 e1aaf77

Please sign in to comment.