File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
Expand file tree Collapse file tree 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"
1515default = [" use_spin" , " const_mut_refs" ]
1616use_spin = [" spinning_top" ]
1717alloc_ref = []
18- const_mut_refs = []
18+ const_mut_refs = [" spinning_top/nightly " ]
1919
2020[dependencies .spinning_top ]
2121version = " 0.1.0"
22- features = [" nightly" ]
2322optional = true
2423
2524[package .metadata .release ]
Original file line number Diff line number Diff line change @@ -194,10 +194,17 @@ pub struct LockedHeap(Spinlock<Heap>);
194194#[ cfg( feature = "use_spin" ) ]
195195impl 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
You can’t perform that action at this time.
0 commit comments