Skip to content

Commit

Permalink
chore: cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
rzvxa committed Jul 29, 2024
1 parent dc7c02a commit d8867e2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tasks/ast_codegen/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ impl KnownLayout {
self.trailing_pad
}

/// number of unused bits scatered throughout layout, this doesn't contain the `trailing_pad`
/// bits.
/// number of available niches
#[inline]
pub fn niches(&self) -> u128 {
self.niches
Expand All @@ -88,7 +87,7 @@ impl KnownLayout {
self.niches -= 1;
} else if can_eat_pad && self.trailing_pad() > 0 {
// consume one byte of padding at the end
self.trailing_pad -= 1;
self.consume_trailing_pad(1);
// consume one and add the remaining values of one byte as niches.
self.niches = (u8::MAX - 1) as u128;
} else if can_resize {
Expand All @@ -97,7 +96,7 @@ impl KnownLayout {
self.trailing_pad += align;
self.consume_niches(n, can_eat_pad, can_resize);
} else {
panic!("`consume_bit` called on a layout without enough space.");
panic!("`{}` called on a layout without enough space.", stringify!(consume_niches));
}
}

Expand Down

0 comments on commit d8867e2

Please sign in to comment.