diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a13209e..5c0627c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -22,5 +22,9 @@ jobs: run: rustup default ${{ matrix.rust }} - name: Build run: cargo build --verbose + - name: Build without default features + run: cargo build --no-default-features --verbose + - name: Build with all features + run: cargo build --all-features --verbose - name: Run tests run: cargo test --verbose diff --git a/Cargo.toml b/Cargo.toml index 0280696..7baa905 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,14 +6,17 @@ homepage = "https://github.com/rcore-os/buddy_system_allocator" repository = "https://github.com/rcore-os/buddy_system_allocator" keywords = ["allocator", "no_std", "heap"] version = "0.9.1" -authors = ["Jiajie Chen ", "Vinay Chandra Dommeti ", "Andrew Walbran "] +authors = [ + "Jiajie Chen ", + "Vinay Chandra Dommeti ", + "Andrew Walbran ", +] edition = "2021" license = "MIT" [features] default = ["use_spin"] use_spin = ["spin"] -const_fn = [] [dependencies.spin] version = "0.9.8" diff --git a/README.md b/README.md index 08eb81c..881f9ea 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,8 @@ You can also use `FrameAllocator` and `LockedHeapWithRescue`, see their document ## Features -- **`use_spin`** (default): Provide a `LockedHeap` type that implements the [`GlobalAlloc`] trait by using a spinlock. -- **`const_fn`** (nightly only): Provide const fn version of `LockedHeapWithRescue::new`. +- **`use_spin`** (default): Provide a `LockedHeap` type that implements the [`GlobalAlloc`] trait by + using a spinlock. [`GlobalAlloc`]: https://doc.rust-lang.org/nightly/core/alloc/trait.GlobalAlloc.html @@ -41,7 +41,7 @@ Some code comes from phil-opp's linked-list-allocator. Licensed under MIT License. Thanks phill-opp's linked-list-allocator for inspirations and interface. -[crate-img]: https://img.shields.io/crates/v/buddy_system_allocator.svg -[crate]: https://crates.io/crates/buddy_system_allocator -[docs-img]: https://docs.rs/buddy_system_allocator/badge.svg -[docs]: https://docs.rs/buddy_system_allocator +[crate-img]: https://img.shields.io/crates/v/buddy_system_allocator.svg +[crate]: https://crates.io/crates/buddy_system_allocator +[docs-img]: https://docs.rs/buddy_system_allocator/badge.svg +[docs]: https://docs.rs/buddy_system_allocator diff --git a/src/lib.rs b/src/lib.rs index 2fb10ea..09f8ea7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,3 @@ -#![cfg_attr(feature = "const_fn", feature(const_mut_refs, const_fn_fn_ptr_basics))] #![no_std] #[cfg(test)] @@ -290,22 +289,12 @@ pub struct LockedHeapWithRescue { #[cfg(feature = "use_spin")] impl LockedHeapWithRescue { /// Creates an empty heap - #[cfg(feature = "const_fn")] pub const fn new(rescue: fn(&mut Heap, &Layout)) -> Self { LockedHeapWithRescue { inner: Mutex::new(Heap::::new()), rescue, } } - - /// Creates an empty heap - #[cfg(not(feature = "const_fn"))] - pub fn new(rescue: fn(&mut Heap, &Layout)) -> Self { - LockedHeapWithRescue { - inner: Mutex::new(Heap::::new()), - rescue, - } - } } #[cfg(feature = "use_spin")]