Skip to content
This repository was archived by the owner on Nov 27, 2020. It is now read-only.

Commit a8305f4

Browse files
committed
Mark NonZeroLayout::padding_needed_for const
1 parent 3a5f227 commit a8305f4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
- Provide default implementation for `realloc`
44
- Don't reexport `Layout`
5-
- Make `NonZeroLayout::size` and `align` const
5+
- Make `NonZeroLayout::size`, `padding_needed_for` and `align` const
66

77
# v0.5
88

src/alloc/layout.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl NonZeroLayout {
134134
/// satisfy this constraint is to ensure `align <= self.align()`.
135135
#[inline]
136136
#[must_use]
137-
pub fn padding_needed_for(&self, align: NonZeroUsize) -> usize {
137+
pub const fn padding_needed_for(&self, align: NonZeroUsize) -> usize {
138138
// Rounded up value is:
139139
// len_rounded_up = (len + align - 1) & !(align - 1);
140140
// and then we return the padding difference: `len_rounded_up - len`.

0 commit comments

Comments
 (0)