Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ pub(crate) use self::inner::{Allocator, Global, do_alloc};
// This is used when building for `std`.
#[cfg(feature = "nightly")]
mod inner {
use core::alloc::Layout;
use core::ptr::NonNull;
#[cfg(test)]
pub(crate) use stdalloc::alloc::AllocError;
use stdalloc::alloc::Layout;
pub(crate) use stdalloc::alloc::{Allocator, Global};

pub(crate) fn do_alloc<A: Allocator>(alloc: &A, layout: Layout) -> Result<NonNull<[u8]>, ()> {
Expand All @@ -33,8 +33,8 @@ mod inner {
#[cfg(test)]
pub(crate) use allocator_api2::alloc::AllocError;
pub(crate) use allocator_api2::alloc::{Allocator, Global};
use core::alloc::Layout;
use core::ptr::NonNull;
use stdalloc::alloc::Layout;

pub(crate) fn do_alloc<A: Allocator>(alloc: &A, layout: Layout) -> Result<NonNull<[u8]>, ()> {
match alloc.allocate(layout) {
Expand All @@ -54,8 +54,9 @@ mod inner {
// or `nightly` without disturbing users that don't want to use it.
#[cfg(not(any(feature = "nightly", feature = "allocator-api2")))]
mod inner {
use core::alloc::Layout;
use core::ptr::NonNull;
use stdalloc::alloc::{Layout, alloc, dealloc};
use stdalloc::alloc::{alloc, dealloc};

#[expect(clippy::missing_safety_doc)] // not exposed outside of this crate
pub unsafe trait Allocator {
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ pub enum TryReserveError {
/// The memory allocator returned an error
AllocError {
/// The layout of the allocation request that failed.
layout: stdalloc::alloc::Layout,
layout: core::alloc::Layout,
},
}

Expand Down
3 changes: 2 additions & 1 deletion src/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ use crate::TryReserveError;
use crate::control::{BitMaskIter, Group, Tag, TagSliceExt};
use crate::scopeguard::{ScopeGuard, guard};
use crate::util::{invalid_mut, likely, unlikely};
use core::alloc::Layout;
use core::array;
use core::iter::FusedIterator;
use core::marker::PhantomData;
use core::mem;
use core::ptr;
use core::ptr::NonNull;
use core::slice;
use stdalloc::alloc::{Layout, handle_alloc_error};
use stdalloc::alloc::handle_alloc_error;

#[cfg(test)]
use crate::alloc::AllocError;
Expand Down
Loading