Skip to content

Commit

Permalink
Block sizes must match in Buffer::eat
Browse files Browse the repository at this point in the history
  • Loading branch information
mkeeter committed Jan 24, 2024
1 parent b78c987 commit 4883ceb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion upstairs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1637,9 +1637,13 @@ impl Buffer {
/// Consume and layer buffer contents on top of this one
///
/// # Panics
/// The offset must be block-aligned; otherwise, this function will panic
/// - The offset must be block-aligned
/// - Both buffers must have the same block size
///
/// If either of these conditions is not met, the function will panic
pub(crate) fn eat(&mut self, offset: usize, buffer: &mut Buffer) {
assert_eq!(offset % self.block_size, 0);
assert_eq!(self.block_size, buffer.block_size);
for (i, (data, owned)) in
std::iter::zip(&buffer.data, &buffer.owned).enumerate()
{
Expand Down

0 comments on commit 4883ceb

Please sign in to comment.