Skip to content

Commit f8496ce

Browse files
Oliver Mangoldintel-lab-lkp
Oliver Mangold
authored andcommitted
rust: Add missing SAFETY documentation for ARef example
SAFETY comment in rustdoc example was just 'TODO'. Fixed. Signed-off-by: Oliver Mangold <[email protected]>
1 parent a1d0c17 commit f8496ce

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rust/kernel/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,15 +492,15 @@ impl<T: RefCounted> ARef<T> {
492492
///
493493
/// struct Empty {}
494494
///
495-
/// # // SAFETY: TODO.
495+
/// // SAFETY: We do not free anything.
496496
/// unsafe impl RefCounted for Empty {
497497
/// fn inc_ref(&self) {}
498498
/// unsafe fn dec_ref(_obj: NonNull<Self>) {}
499499
/// }
500500
///
501501
/// let mut data = Empty {};
502502
/// let ptr = NonNull::<Empty>::new(&mut data).unwrap();
503-
/// # // SAFETY: TODO.
503+
/// // SAFETY: We keep `data` around longer than the `ARef`.
504504
/// let data_ref: ARef<Empty> = unsafe { ARef::from_raw(ptr) };
505505
/// let raw_ptr: NonNull<Empty> = ARef::into_raw(data_ref);
506506
///

0 commit comments

Comments
 (0)