diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2023-01-30 12:00:11 +0000 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@gmail.com> | 2023-01-30 12:26:26 +0000 |
| commit | 4d75f618323cb26a31396f20fe91c35efba9b823 (patch) | |
| tree | 5199029df546a317a16c8e1477bf118b4d9f05d4 /compiler/rustc_const_eval/src/interpret | |
| parent | fd649a3cc5e9f17c8aee070227e8c71f094560b7 (diff) | |
| download | rust-4d75f618323cb26a31396f20fe91c35efba9b823.tar.gz rust-4d75f618323cb26a31396f20fe91c35efba9b823.zip | |
Use `Mutability::{is_mut, is_not}`
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/memory.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/memory.rs b/compiler/rustc_const_eval/src/interpret/memory.rs index 291bfb2b558..a87ce0053e8 100644 --- a/compiler/rustc_const_eval/src/interpret/memory.rs +++ b/compiler/rustc_const_eval/src/interpret/memory.rs @@ -304,7 +304,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { .into()); }; - if alloc.mutability == Mutability::Not { + if alloc.mutability.is_not() { throw_ub_format!("deallocating immutable allocation {alloc_id:?}"); } if alloc_kind != kind { @@ -631,7 +631,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { } let (_kind, alloc) = self.memory.alloc_map.get_mut(id).unwrap(); - if alloc.mutability == Mutability::Not { + if alloc.mutability.is_not() { throw_ub!(WriteToReadOnly(id)) } Ok((alloc, &mut self.machine)) |
