Skip to content

Commit

Permalink
Const functions are stable since 1.61, so no need to feature guard them.
Browse files Browse the repository at this point in the history
  • Loading branch information
qwandor committed Jul 1, 2024
1 parent 12aeecc commit 0f7a94d
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@ jobs:
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
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ license = "MIT"
[features]
default = ["alloc", "use_spin"]
alloc = []
const_fn = []
use_spin = ["spin"]

[dependencies.spin]
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ You can also use `FrameAllocator` and `LockedHeapWithRescue`, see their document
global allocator.
- **`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`.

[`GlobalAlloc`]: https://doc.rust-lang.org/nightly/core/alloc/trait.GlobalAlloc.html

Expand Down
11 changes: 0 additions & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![cfg_attr(feature = "const_fn", feature(const_mut_refs, const_fn_fn_ptr_basics))]
#![no_std]

#[cfg(test)]
Expand Down Expand Up @@ -293,22 +292,12 @@ pub struct LockedHeapWithRescue<const ORDER: usize> {
#[cfg(feature = "use_spin")]
impl<const ORDER: usize> LockedHeapWithRescue<ORDER> {
/// Creates an empty heap
#[cfg(feature = "const_fn")]
pub const fn new(rescue: fn(&mut Heap<ORDER>, &Layout)) -> Self {
LockedHeapWithRescue {
inner: Mutex::new(Heap::<ORDER>::new()),
rescue,
}
}

/// Creates an empty heap
#[cfg(not(feature = "const_fn"))]
pub fn new(rescue: fn(&mut Heap<ORDER>, &Layout)) -> Self {
LockedHeapWithRescue {
inner: Mutex::new(Heap::<ORDER>::new()),
rescue,
}
}
}

#[cfg(feature = "use_spin")]
Expand Down

0 comments on commit 0f7a94d

Please sign in to comment.