Skip to content

Commit 70ea4e2

Browse files
authored
Merge pull request #46 from phil-opp/build-on-stable
Don't require nightly for `use_spin` feature
2 parents 82b40f0 + 8876de4 commit 70ea4e2

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

.github/workflows/build.yml

+6
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ jobs:
7272
- name: "Run cargo test without features on stable"
7373
run: cargo +stable test --no-default-features
7474

75+
- name: "Build with `use_spin` feature on stable"
76+
run: cargo +stable build --no-default-features --features use_spin
77+
78+
- name: "Run cargo test with `use_spin` feature on stable"
79+
run: cargo +stable test --no-default-features --features use_spin
80+
7581
test-unstable:
7682
name: "Test unstable features"
7783

Cargo.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@ homepage = "http://os.phil-opp.com/kernel-heap.html#a-better-allocator"
1515
default = ["use_spin", "const_mut_refs"]
1616
use_spin = ["spinning_top"]
1717
alloc_ref = []
18-
const_mut_refs = []
18+
const_mut_refs = ["spinning_top/nightly"]
1919

2020
[dependencies.spinning_top]
2121
version = "0.1.0"
22-
features = ["nightly"]
2322
optional = true
2423

2524
[package.metadata.release]

Changelog.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Unreleased
22

3+
- Don't require nightly for `use_spin` feature ([#46](https://github.com/phil-opp/linked-list-allocator/pull/46))
4+
35
# 0.8.8 – 2020-12-16
46

57
- Do not require alloc crate ([#44](https://github.com/phil-opp/linked-list-allocator/pull/44))

src/lib.rs

+7
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,17 @@ pub struct LockedHeap(Spinlock<Heap>);
194194
#[cfg(feature = "use_spin")]
195195
impl LockedHeap {
196196
/// Creates an empty heap. All allocate calls will return `None`.
197+
#[cfg(feature = "const_mut_refs")]
197198
pub const fn empty() -> LockedHeap {
198199
LockedHeap(Spinlock::new(Heap::empty()))
199200
}
200201

202+
/// Creates an empty heap. All allocate calls will return `None`.
203+
#[cfg(not(feature = "const_mut_refs"))]
204+
pub fn empty() -> LockedHeap {
205+
LockedHeap(Spinlock::new(Heap::empty()))
206+
}
207+
201208
/// Creates a new heap with the given `bottom` and `size`. The bottom address must be valid
202209
/// and the memory in the `[heap_bottom, heap_bottom + heap_size)` range must not be used for
203210
/// anything else. This function is unsafe because it can cause undefined behavior if the

0 commit comments

Comments
 (0)