Skip to content

Commit c17d11f

Browse files
committed
code review fixes
1 parent a1e59d1 commit c17d11f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/librustc/mir/interpret/allocation.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,17 +235,17 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
235235
{
236236
assert_eq!(ptr.offset.bytes() as usize as u64, ptr.offset.bytes());
237237
let offset = ptr.offset.bytes() as usize;
238-
match self.bytes[offset..].iter().position(|&c| c == 0) {
238+
Ok(match self.bytes[offset..].iter().position(|&c| c == 0) {
239239
Some(size) => {
240240
let size_with_null = Size::from_bytes((size + 1) as u64);
241241
// Go through `get_bytes` for checks and AllocationExtra hooks.
242242
// We read the null, so we include it in the request, but we want it removed
243243
// from the result, so we do subslicing.
244-
Ok(&self.get_bytes(cx, ptr, size_with_null)?[..size])
244+
&self.get_bytes(cx, ptr, size_with_null)?[..size]
245245
}
246246
// This includes the case where `offset` is out-of-bounds to begin with.
247247
None => throw_unsup!(UnterminatedCString(ptr.erase_tag())),
248-
}
248+
})
249249
}
250250

251251
/// Validates that `ptr.offset` and `ptr.offset + size` do not point to the middle of a

0 commit comments

Comments
 (0)