File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -498,15 +498,17 @@ impl<T: RefCounted> ARef<T> {
498498 ///
499499 /// struct Empty {}
500500 ///
501- /// # // SAFETY: TODO.
501+ /// // SAFETY: The `RefCounted` implementation for `Empty` does not count references
502+ /// // and never frees the underlying object. Thus we can act as having a
503+ /// // refcount on the object that we pass to the newly created `ARef`.
502504 /// unsafe impl RefCounted for Empty {
503505 /// fn inc_ref(&self) {}
504506 /// unsafe fn dec_ref(_obj: NonNull<Self>) {}
505507 /// }
506508 ///
507509 /// let mut data = Empty {};
508510 /// let ptr = NonNull::<Empty>::new(&mut data).unwrap();
509- /// # // SAFETY: TODO .
511+ /// // SAFETY: We keep `data` around longer than the `ARef` .
510512 /// let data_ref: ARef<Empty> = unsafe { ARef::from_raw(ptr) };
511513 /// let raw_ptr: NonNull<Empty> = ARef::into_raw(data_ref);
512514 ///
You can’t perform that action at this time.
0 commit comments