diff --git a/Cargo.toml b/Cargo.toml index aae28e4..6df1fac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ path = "tests/try_alloc.rs" harness = false [dependencies] -allocator-api2 = { version = "0.2.7-rc.1", default-features = false, optional = true, features = ["alloc"] } +allocator-api2 = { version = "0.2.8", default-features = false, optional = true, features = ["alloc"] } [dev-dependencies] quickcheck = "1.0.3" @@ -42,8 +42,7 @@ rand = "0.8.5" default = [] collections = [] boxed = [] -allocator_api = ["allocator-api2"] -nightly = ["allocator_api"] +allocator_api = [] # [profile.bench] # debug = true diff --git a/src/lib.rs b/src/lib.rs index 603648f..c25e03c 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,7 +2,7 @@ #![deny(missing_debug_implementations)] #![deny(missing_docs)] #![no_std] -#![cfg_attr(feature = "nightly", feature(allocator_api))] +#![cfg_attr(feature = "allocator_api", feature(allocator_api))] #[doc(hidden)] pub extern crate alloc as core_alloc; @@ -24,10 +24,10 @@ use core::slice; use core::str; use core_alloc::alloc::{alloc, dealloc, Layout}; -#[cfg(feature = "nightly")] +#[cfg(feature = "allocator_api")] use core_alloc::alloc::{AllocError, Allocator}; -#[cfg(all(feature = "allocator_api", not(feature = "nightly")))] +#[cfg(all(feature = "allocator-api2", not(feature = "allocator_api")))] use allocator_api2::alloc::{AllocError, Allocator}; pub use alloc::AllocErr; @@ -1887,7 +1887,7 @@ unsafe impl<'a> alloc::Alloc for &'a Bump { } } -#[cfg(feature = "allocator_api")] +#[cfg(any(feature = "allocator_api", feature = "allocator-api2"))] unsafe impl<'a> Allocator for &'a Bump { fn allocate(&self, layout: Layout) -> Result, AllocError> { self.try_alloc_layout(layout)