Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Const functions are stable since 1.61, so no need to feature guard them. #33

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading