Skip to content

Commit c4dbacf

Browse files
committed
Document that Object contains UnsafeCell
1 parent 2438529 commit c4dbacf

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

objc2/src/runtime.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
//! For more information on foreign functions, see Apple's documentation:
44
//! <https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ObjCRuntimeRef/index.html>
55
6+
#[cfg(doc)]
7+
use core::cell::UnsafeCell;
68
use core::fmt;
79
use core::hash;
810
use core::panic::{RefUnwindSafe, UnwindSafe};
@@ -593,6 +595,11 @@ fn ivar_offset<T: Encode>(cls: &Class, name: &str) -> isize {
593595
///
594596
/// `Id<Object, _>` is equivalent to Objective-C's `id`.
595597
///
598+
/// This contains [`UnsafeCell`], and is similar to that in that one can
599+
/// safely access and perform interior mutability on this (both via.
600+
/// [`msg_send!`] and through ivars), so long as Rust's mutability rules are
601+
/// upheld, and that data races are avoided.
602+
///
596603
/// Note: This is intentionally neither [`Sync`], [`Send`], [`UnwindSafe`],
597604
/// [`RefUnwindSafe`] nor [`Unpin`], since that is something that may change
598605
/// depending on the specific subclass. For example, `NSAutoreleasePool` is

0 commit comments

Comments
 (0)