diff --git a/Cargo.toml b/Cargo.toml index 7bc11679b..1d28792de 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,7 +47,7 @@ default = ["default-hasher", "inline-more", "allocator-api2", "equivalent", "raw # Enables use of nightly features. This is only guaranteed to work on the latest # version of nightly Rust. -nightly = ["allocator-api2?/nightly", "bumpalo/allocator_api"] +nightly = ["bumpalo/allocator_api"] # Enables the RustcEntry API used to provide the standard library's Entry API. rustc-internal-api = [] diff --git a/src/map.rs b/src/map.rs index c373d5958..baf93925b 100644 --- a/src/map.rs +++ b/src/map.rs @@ -4690,9 +4690,9 @@ mod test_map { use super::Entry::{Occupied, Vacant}; use super::EntryRef; use super::HashMap; + use crate::raw::{AllocError, Allocator, Global}; use alloc::string::{String, ToString}; use alloc::sync::Arc; - use allocator_api2::alloc::{AllocError, Allocator, Global}; use core::alloc::Layout; use core::ptr::NonNull; use core::sync::atomic::{AtomicI8, Ordering}; diff --git a/src/raw/alloc.rs b/src/raw/alloc.rs index 15299e7b0..d1ac5237a 100644 --- a/src/raw/alloc.rs +++ b/src/raw/alloc.rs @@ -1,4 +1,5 @@ pub(crate) use self::inner::{do_alloc, Allocator, Global}; +#[cfg(test)] pub(crate) use self::inner::AllocError; // Nightly-case. // Use unstable `allocator_api` feature. @@ -8,6 +9,7 @@ pub(crate) use self::inner::{do_alloc, Allocator, Global}; mod inner { use crate::alloc::alloc::Layout; pub use crate::alloc::alloc::{Allocator, Global}; + #[cfg(test)] pub use crate::alloc::alloc::AllocError; use core::ptr::NonNull; #[allow(clippy::map_err_ignore)] @@ -29,6 +31,7 @@ mod inner { mod inner { use crate::alloc::alloc::Layout; pub use allocator_api2::alloc::{Allocator, Global}; + #[cfg(test)] pub use allocator_api2::alloc::AllocError; use core::ptr::NonNull; #[allow(clippy::map_err_ignore)] diff --git a/src/raw/mod.rs b/src/raw/mod.rs index 2773b6725..51620694f 100644 --- a/src/raw/mod.rs +++ b/src/raw/mod.rs @@ -13,6 +13,7 @@ use core::{hint, ptr}; mod alloc; pub(crate) use self::alloc::{do_alloc, Allocator, Global}; +#[cfg(test)] pub(crate) use self::alloc::AllocError; #[inline] unsafe fn offset_from(to: *const T, from: *const T) -> usize { @@ -4240,7 +4241,7 @@ mod test_map { fn test_catch_panic_clone_from() { use ::alloc::sync::Arc; use ::alloc::vec::Vec; - use allocator_api2::alloc::{AllocError, Allocator, Global}; + use super::{AllocError, Allocator, Global}; use core::sync::atomic::{AtomicI8, Ordering}; use std::thread;