Skip to content

Commit a638119

Browse files
committed
Don't require nightly for use_spin feature
1 parent 199994c commit a638119

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

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]

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)