Skip to content

Commit

Permalink
Don't enable allocator-api2/nightly feature
Browse files Browse the repository at this point in the history
See #564 for rationale. Tentatively fixes said issue and #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 283570e
Show file tree
Hide file tree
Showing 4 changed files with 7 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
3 changes: 3 additions & 0 deletions src/raw/alloc.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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)]
Expand All @@ -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)]
Expand Down
3 changes: 2 additions & 1 deletion src/raw/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>(to: *const T, from: *const T) -> usize {
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 283570e

Please sign in to comment.