mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
Rollup merge of #86685 - RalfJung:alloc-mut, r=oli-obk
double-check mutability inside Allocation r? `@oli-obk`
This commit is contained in:
commit
1ca32050b1
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user