Skip to content

Commit 6a52d22

Browse files
committed
refactor: Remove calcualuate_layout for the nightly feature
It was only used in `into_allocation` now so it does not pull its weight.
1 parent 93ba7fe commit 6a52d22

File tree

1 file changed

+0
-27
lines changed

1 file changed

+0
-27
lines changed

src/raw/mod.rs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -225,32 +225,6 @@ fn bucket_mask_to_capacity(bucket_mask: usize) -> usize {
225225
}
226226
}
227227

228-
/// Returns a Layout which describes the allocation required for a hash table,
229-
/// and the offset of the control bytes in the allocation.
230-
/// (the offset is also one past last element of buckets)
231-
///
232-
/// Returns `None` if an overflow occurs.
233-
#[cfg_attr(feature = "inline-more", inline)]
234-
#[cfg(feature = "nightly")]
235-
fn calculate_layout<T>(buckets: usize) -> Option<(Layout, usize)> {
236-
debug_assert!(buckets.is_power_of_two());
237-
238-
// Array of buckets
239-
let data = Layout::array::<T>(buckets).ok()?;
240-
241-
// Array of control bytes. This must be aligned to the group size.
242-
//
243-
// We add `Group::WIDTH` control bytes at the end of the array which
244-
// replicate the bytes at the start of the array and thus avoids the need to
245-
// perform bounds-checking while probing.
246-
//
247-
// There is no possible overflow here since buckets is a power of two and
248-
// Group::WIDTH is a small number.
249-
let ctrl = unsafe { Layout::from_size_align_unchecked(buckets + Group::WIDTH, Group::WIDTH) };
250-
251-
data.extend(ctrl).ok()
252-
}
253-
254228
/// Helper which allows the max calculation for ctrl_align to be statically computed for each T
255229
/// while keeping the rest of `calculate_layout_for` independent of `T`
256230
#[derive(Copy, Clone)]
@@ -292,7 +266,6 @@ impl TableLayout {
292266
///
293267
/// Returns `None` if an overflow occurs.
294268
#[cfg_attr(feature = "inline-more", inline)]
295-
#[cfg(not(feature = "nightly"))]
296269
fn calculate_layout<T>(buckets: usize) -> Option<(Layout, usize)> {
297270
TableLayout::new::<T>().calculate_layout_for(buckets)
298271
}

0 commit comments

Comments
 (0)