aboutsummaryrefslogtreecommitdiff
path: root/rust/kernel/alloc/box_ext.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/kernel/alloc/box_ext.rs')
-rw-r--r--rust/kernel/alloc/box_ext.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/rust/kernel/alloc/box_ext.rs b/rust/kernel/alloc/box_ext.rs
index b68ade26a42d..5b1550d620fd 100644
--- a/rust/kernel/alloc/box_ext.rs
+++ b/rust/kernel/alloc/box_ext.rs
@@ -26,9 +26,11 @@ pub trait BoxExt<T>: Sized {
/// use kernel::alloc::{flags, box_ext::BoxExt};
/// let value = Box::new([0; 32], flags::GFP_KERNEL)?;
/// assert_eq!(*value, [0; 32]);
- /// let value = Box::drop_contents(value);
+ /// let mut value = Box::drop_contents(value);
/// // Now we can re-use `value`:
- /// let value = Box::write(value, [1; 32]);
+ /// value.write([1; 32]);
+ /// // SAFETY: We just wrote to it.
+ /// let value = unsafe { value.assume_init() };
/// assert_eq!(*value, [1; 32]);
/// # Ok::<(), Error>(())
/// ```