diff options
| author | Yuki Okushi <jtitor@2k36.org> | 2021-07-06 02:33:14 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-06 02:33:14 +0900 |
| commit | 1ca32050b18c34d5383a6ca11f7c686d4d3117d0 (patch) | |
| tree | 2b983a605a767b8aa93775e06f486123371f7640 | |
| parent | add24d2f4fe5f4194bf81d6be6e539491e776918 (diff) | |
| parent | 719dafc48b3a076e9f6341be97bad0cef316f24b (diff) | |
| download | rust-1ca32050b18c34d5383a6ca11f7c686d4d3117d0.tar.gz rust-1ca32050b18c34d5383a6ca11f7c686d4d3117d0.zip | |
Rollup merge of #86685 - RalfJung:alloc-mut, r=oli-obk
double-check mutability inside Allocation r? `@oli-obk`
| -rw-r--r-- | compiler/rustc_middle/src/mir/interpret/allocation.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/mir/interpret/allocation.rs b/compiler/rustc_middle/src/mir/interpret/allocation.rs index f1b1bb9ab88..c2645a09140 100644 --- a/compiler/rustc_middle/src/mir/interpret/allocation.rs +++ b/compiler/rustc_middle/src/mir/interpret/allocation.rs @@ -361,6 +361,8 @@ impl<Tag: Copy, Extra> Allocation<Tag, Extra> { range: AllocRange, val: ScalarMaybeUninit<Tag>, ) -> AllocResult { + assert!(self.mutability == Mutability::Mut); + let val = match val { ScalarMaybeUninit::Scalar(scalar) => scalar, ScalarMaybeUninit::Uninit => { @@ -484,6 +486,7 @@ impl<Tag: Copy, Extra> Allocation<Tag, Extra> { if range.size.bytes() == 0 { return; } + assert!(self.mutability == Mutability::Mut); self.init_mask.set_range(range.start, range.end(), is_init); } } |
