diff options
Diffstat (limited to 'rust/kernel/alloc.rs')
-rw-r--r-- | rust/kernel/alloc.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/rust/kernel/alloc.rs b/rust/kernel/alloc.rs index 91b2a26faf3d..28281d600492 100644 --- a/rust/kernel/alloc.rs +++ b/rust/kernel/alloc.rs @@ -2,12 +2,17 @@ //! Extensions to the [`alloc`] crate. -#[cfg(not(test))] -#[cfg(not(testlib))] +#[cfg(not(any(test, testlib)))] pub mod allocator; pub mod box_ext; pub mod vec_ext; +#[cfg(any(test, testlib))] +pub mod allocator_test; + +#[cfg(any(test, testlib))] +pub use self::allocator_test as allocator; + /// Indicates an allocation error. #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub struct AllocError; @@ -188,6 +193,7 @@ pub unsafe trait Allocator { } } +#[allow(dead_code)] /// Returns a properly aligned dangling pointer from the given `layout`. pub(crate) fn dangling_from_layout(layout: Layout) -> NonNull<u8> { let ptr = layout.align() as *mut u8; |