File tree 2 files changed +8
-2
lines changed
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -15,11 +15,10 @@ homepage = "http://os.phil-opp.com/kernel-heap.html#a-better-allocator"
15
15
default = [" use_spin" , " const_mut_refs" ]
16
16
use_spin = [" spinning_top" ]
17
17
alloc_ref = []
18
- const_mut_refs = []
18
+ const_mut_refs = [" spinning_top/nightly " ]
19
19
20
20
[dependencies .spinning_top ]
21
21
version = " 0.1.0"
22
- features = [" nightly" ]
23
22
optional = true
24
23
25
24
[package .metadata .release ]
Original file line number Diff line number Diff line change @@ -194,10 +194,17 @@ pub struct LockedHeap(Spinlock<Heap>);
194
194
#[ cfg( feature = "use_spin" ) ]
195
195
impl LockedHeap {
196
196
/// Creates an empty heap. All allocate calls will return `None`.
197
+ #[ cfg( feature = "const_mut_refs" ) ]
197
198
pub const fn empty ( ) -> LockedHeap {
198
199
LockedHeap ( Spinlock :: new ( Heap :: empty ( ) ) )
199
200
}
200
201
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
+
201
208
/// Creates a new heap with the given `bottom` and `size`. The bottom address must be valid
202
209
/// and the memory in the `[heap_bottom, heap_bottom + heap_size)` range must not be used for
203
210
/// anything else. This function is unsafe because it can cause undefined behavior if the
You can’t perform that action at this time.
0 commit comments