Skip to content

Commit 4399299

Browse files
committed
mark_definedness cannot fail
1 parent 9cb052a commit 4399299

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/librustc/mir/interpret/allocation.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
247247
assert_ne!(size.bytes(), 0, "0-sized accesses should never even get a `Pointer`");
248248
self.check_bounds(cx, ptr, size, CheckInAllocMsg::MemoryAccessTest)?;
249249

250-
self.mark_definedness(ptr, size, true)?;
250+
self.mark_definedness(ptr, size, true);
251251
self.clear_relocations(cx, ptr, size)?;
252252

253253
AllocationExtra::memory_written(self, ptr, size)?;
@@ -406,7 +406,10 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
406406
{
407407
let val = match val {
408408
ScalarMaybeUndef::Scalar(scalar) => scalar,
409-
ScalarMaybeUndef::Undef => return self.mark_definedness(ptr, type_size, false),
409+
ScalarMaybeUndef::Undef => {
410+
self.mark_definedness(ptr, type_size, false);
411+
return Ok(());
412+
},
410413
};
411414

412415
let bytes = match val.to_bits_or_ptr(type_size, cx) {
@@ -550,16 +553,15 @@ impl<'tcx, Tag, Extra> Allocation<Tag, Extra> {
550553
ptr: Pointer<Tag>,
551554
size: Size,
552555
new_state: bool,
553-
) -> InterpResult<'tcx> {
556+
) {
554557
if size.bytes() == 0 {
555-
return Ok(());
558+
return;
556559
}
557560
self.undef_mask.set_range(
558561
ptr.offset,
559562
ptr.offset + size,
560563
new_state,
561564
);
562-
Ok(())
563565
}
564566
}
565567

0 commit comments

Comments
 (0)