From e6a7eb08e61746a2816b853b2b03a28b05e93412 Mon Sep 17 00:00:00 2001 From: Karl Meakin Date: Fri, 17 Nov 2023 03:41:15 +0000 Subject: [PATCH] Annotate `Allocator` methods with `#[inline]` These methods were not annotated with `#[inline]`, meaning they will not be inlined into client crates unless they enable LTO --- src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index cfe7c0c..4ccc6f0 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -1875,6 +1875,7 @@ unsafe impl<'a> alloc::Alloc for &'a Bump { #[cfg(any(feature = "allocator_api", feature = "allocator-api2"))] unsafe impl<'a> Allocator for &'a Bump { + #[inline] fn allocate(&self, layout: Layout) -> Result, AllocError> { self.try_alloc_layout(layout) .map(|p| unsafe { @@ -1883,10 +1884,12 @@ unsafe impl<'a> Allocator for &'a Bump { .map_err(|_| AllocError) } + #[inline] unsafe fn deallocate(&self, ptr: NonNull, layout: Layout) { Bump::dealloc(self, ptr, layout) } + #[inline] unsafe fn shrink( &self, ptr: NonNull, @@ -1900,6 +1903,7 @@ unsafe impl<'a> Allocator for &'a Bump { .map_err(|_| AllocError) } + #[inline] unsafe fn grow( &self, ptr: NonNull, @@ -1913,6 +1917,7 @@ unsafe impl<'a> Allocator for &'a Bump { .map_err(|_| AllocError) } + #[inline] unsafe fn grow_zeroed( &self, ptr: NonNull,