Skip to content

Don't require nightly for use_spin feature #46

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

Merged
merged 3 commits into from
Dec 27, 2020
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
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ jobs:
- name: "Run cargo test without features on stable"
run: cargo +stable test --no-default-features

- name: "Build with `use_spin` feature on stable"
run: cargo +stable build --no-default-features --features use_spin

- name: "Run cargo test with `use_spin` feature on stable"
run: cargo +stable test --no-default-features --features use_spin

test-unstable:
name: "Test unstable features"

Expand Down
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ homepage = "http://os.phil-opp.com/kernel-heap.html#a-better-allocator"
default = ["use_spin", "const_mut_refs"]
use_spin = ["spinning_top"]
alloc_ref = []
const_mut_refs = []
const_mut_refs = ["spinning_top/nightly"]

[dependencies.spinning_top]
version = "0.1.0"
features = ["nightly"]
optional = true

[package.metadata.release]
Expand Down
2 changes: 2 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Unreleased

- Don't require nightly for `use_spin` feature ([#46](https://github.com/phil-opp/linked-list-allocator/pull/46))

# 0.8.8 – 2020-12-16

- Do not require alloc crate ([#44](https://github.com/phil-opp/linked-list-allocator/pull/44))
Expand Down
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,17 @@ pub struct LockedHeap(Spinlock<Heap>);
#[cfg(feature = "use_spin")]
impl LockedHeap {
/// Creates an empty heap. All allocate calls will return `None`.
#[cfg(feature = "const_mut_refs")]
pub const fn empty() -> LockedHeap {
LockedHeap(Spinlock::new(Heap::empty()))
}

/// Creates an empty heap. All allocate calls will return `None`.
#[cfg(not(feature = "const_mut_refs"))]
pub fn empty() -> LockedHeap {
LockedHeap(Spinlock::new(Heap::empty()))
}

/// Creates a new heap with the given `bottom` and `size`. The bottom address must be valid
/// and the memory in the `[heap_bottom, heap_bottom + heap_size)` range must not be used for
/// anything else. This function is unsafe because it can cause undefined behavior if the
Expand Down