Skip to content

Commit edd4f9d

Browse files
committed
Use allocator-api2 only on stable
Keep feature semantics
1 parent f04be75 commit edd4f9d

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ path = "tests/try_alloc.rs"
3131
harness = false
3232

3333
[dependencies]
34-
allocator-api2 = { version = "0.2.7-rc.1", default-features = false, optional = true, features = ["alloc"] }
34+
allocator-api2 = { version = "0.2.8", default-features = false, optional = true, features = ["alloc"] }
3535

3636
[dev-dependencies]
3737
quickcheck = "1.0.3"
@@ -42,8 +42,7 @@ rand = "0.8.5"
4242
default = []
4343
collections = []
4444
boxed = []
45-
allocator_api = ["allocator-api2"]
46-
nightly = ["allocator_api"]
45+
allocator_api = []
4746

4847
# [profile.bench]
4948
# debug = true

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#![deny(missing_debug_implementations)]
33
#![deny(missing_docs)]
44
#![no_std]
5-
#![cfg_attr(feature = "nightly", feature(allocator_api))]
5+
#![cfg_attr(feature = "allocator_api", feature(allocator_api))]
66

77
#[doc(hidden)]
88
pub extern crate alloc as core_alloc;
@@ -24,10 +24,10 @@ use core::slice;
2424
use core::str;
2525
use core_alloc::alloc::{alloc, dealloc, Layout};
2626

27-
#[cfg(feature = "nightly")]
27+
#[cfg(feature = "allocator_api")]
2828
use core_alloc::alloc::{AllocError, Allocator};
2929

30-
#[cfg(all(feature = "allocator_api", not(feature = "nightly")))]
30+
#[cfg(all(feature = "allocator-api2", not(feature = "allocator_api")))]
3131
use allocator_api2::alloc::{AllocError, Allocator};
3232

3333
pub use alloc::AllocErr;
@@ -1887,7 +1887,7 @@ unsafe impl<'a> alloc::Alloc for &'a Bump {
18871887
}
18881888
}
18891889

1890-
#[cfg(feature = "allocator_api")]
1890+
#[cfg(any(feature = "allocator_api", feature = "allocator-api2"))]
18911891
unsafe impl<'a> Allocator for &'a Bump {
18921892
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
18931893
self.try_alloc_layout(layout)

0 commit comments

Comments
 (0)