Skip to content

Commit

Permalink
Don't enable allocator-api2/nightly feature
Browse files Browse the repository at this point in the history
See rust-lang#564 for rationale. Tentatively fixes said issue and rust-lang#483, though
the root cause is up to the `allocator-api2` crate to fix.
Direct use of `allocator-api2` in tests had to be replaced with the
indirection used elsewhere in the crate.
  • Loading branch information
Youser Nayme authored and Youser Nayme committed Jan 27, 2025
1 parent d76a3de commit b64eb93
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
2 changes: 1 addition & 1 deletion src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
6 changes: 6 additions & 0 deletions src/raw/alloc.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#[cfg(test)]
pub(crate) use self::inner::AllocError;
pub(crate) use self::inner::{do_alloc, Allocator, Global};

// Nightly-case.
Expand All @@ -6,6 +8,8 @@ pub(crate) use self::inner::{do_alloc, Allocator, Global};
// This is used when building for `std`.
#[cfg(feature = "nightly")]
mod inner {
#[cfg(test)]
pub use crate::alloc::alloc::AllocError;
use crate::alloc::alloc::Layout;
pub use crate::alloc::alloc::{Allocator, Global};
use core::ptr::NonNull;
Expand All @@ -28,6 +32,8 @@ mod inner {
#[cfg(all(not(feature = "nightly"), feature = "allocator-api2"))]
mod inner {
use crate::alloc::alloc::Layout;
#[cfg(test)]
pub use allocator_api2::alloc::AllocError;
pub use allocator_api2::alloc::{Allocator, Global};
use core::ptr::NonNull;

Expand Down
4 changes: 3 additions & 1 deletion src/raw/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ use core::slice;
use core::{hint, ptr};

mod alloc;
#[cfg(test)]
pub(crate) use self::alloc::AllocError;
pub(crate) use self::alloc::{do_alloc, Allocator, Global};

#[inline]
Expand Down Expand Up @@ -4238,9 +4240,9 @@ mod test_map {
/// ARE ZERO, EVEN IF WE HAVE `FULL` CONTROL BYTES.
#[test]
fn test_catch_panic_clone_from() {
use super::{AllocError, Allocator, Global};
use ::alloc::sync::Arc;
use ::alloc::vec::Vec;
use allocator_api2::alloc::{AllocError, Allocator, Global};
use core::sync::atomic::{AtomicI8, Ordering};
use std::thread;

Expand Down

0 comments on commit b64eb93

Please sign in to comment.