summaryrefslogtreecommitdiff
path: root/crates/alloc_physmem_free_list/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/alloc_physmem_free_list/src/lib.rs')
-rw-r--r--crates/alloc_physmem_free_list/src/lib.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/alloc_physmem_free_list/src/lib.rs b/crates/alloc_physmem_free_list/src/lib.rs
index f99b30f..0540672 100644
--- a/crates/alloc_physmem_free_list/src/lib.rs
+++ b/crates/alloc_physmem_free_list/src/lib.rs
@@ -43,6 +43,10 @@ impl<'allocator, const PAGE_SIZE: usize> FreeListAllocator<'allocator, PAGE_SIZE
/// Obviously, this is unsound to call while the previous allocation is alive. It is also
/// unsound to split any nodes after calling this, since splitting the node that was allocated
/// into might write the new node's metadata into that allocation.
+ ///
+ /// # Safety
+ ///
+ /// - Only one allocation returned by this method may be live.
pub unsafe fn allocate_without_always_removing_the_node(
&mut self,
layout: Layout,
@@ -186,6 +190,12 @@ impl<'allocator, const PAGE_SIZE: usize> fmt::Debug for FreeListAllocator<'alloc
}
}
+impl<'allocator, const PAGE_SIZE: usize> Default for FreeListAllocator<'allocator, PAGE_SIZE> {
+ fn default() -> FreeListAllocator<'allocator, PAGE_SIZE> {
+ FreeListAllocator::new()
+ }
+}
+
/// A pointer to a page range, which start with a header in the first page.
///
/// # Safety