Skip to main content

assert_allocator_respects_alignment

Function assert_allocator_respects_alignment 

Source
pub fn assert_allocator_respects_alignment<A>(a: &A)
where A: Allocator,
Expand description

Verify that allocate returns pointers aligned to the requested alignment, across every power-of-two alignment from 1 to 512. (Covers up through CACHE_LINE = 128 on every supported target plus a 4-KiB-page-aligned slot.)

Allocators that legitimately reject high alignments (e.g. InlineBacked rejects anything above MAX_ALIGN = 16) are not flagged as failing: the helper only asserts that successful returns are correctly aligned.

Panics if a successful allocation returns an under-aligned pointer.