Lines Matching full:safety

153     /// # Safety
159 // SAFETY: The caller guarantees that the pointer is valid. in container_of()
161 // SAFETY: We're computing the layout of a real struct that existed when compiling this in container_of()
172 // SAFETY: The pointer is in-bounds of an allocation both before and after offsetting the in container_of()
177 // SAFETY: The pointer can't be null since you can't have an `ArcInner<T>` value at the null in container_of()
192 // SAFETY: It is safe to send `Arc<T>` to another thread when the underlying `T` is `Sync` because
198 // SAFETY: It is safe to send `&Arc<T>` to another thread when the underlying `T` is `Sync`
230 // SAFETY: There are no safety requirements for this FFI call. in new()
238 // SAFETY: We just created `inner` with a reference count of 1, which is owned by the new in new()
247 /// # Safety
252 // INVARIANT: By the safety requirements, the invariants hold. in from_inner()
265 // SAFETY: The pointer is valid. in into_raw()
273 // SAFETY: As `ptr` points to a valid allocation of type `ArcInner`, in as_ptr()
280 /// # Safety
285 // SAFETY: The caller promises that this pointer originates from a call to `into_raw` on an in from_raw()
289 // SAFETY: By the safety requirements we know that `ptr` came from `Arc::into_raw`, so the in from_raw()
300 // SAFETY: The constraint that the lifetime of the shared reference must outlive that of in as_arc_borrow()
348 // SAFETY: We own a refcount, so the pointer is still valid. in into_unique_or_drop()
355 // SAFETY: We own a refcount, so the pointer is not dangling. in into_unique_or_drop()
358 // SAFETY: We have exclusive access to the arc, so we can perform unsynchronized in into_unique_or_drop()
383 // SAFETY: The safety requirements of this function ensure that `ptr` comes from a previous in from_foreign()
387 // SAFETY: By the safety requirement of this function, we know that `ptr` came from in from_foreign()
394 // SAFETY: The safety requirements of this function ensure that `ptr` comes from a previous in borrow()
398 // SAFETY: The safety requirements of `from_foreign` ensure that the object remains alive in borrow()
404 // SAFETY: The safety requirements for `borrow_mut` are a superset of the safety in borrow_mut()
414 // SAFETY: By the type invariant, there is necessarily a reference to the object, so it is in deref()
428 // SAFETY: By the type invariant, there is necessarily a reference to the object, so it is in clone()
433 // SAFETY: By the type invariant, there is necessarily a reference to the object, so it is in clone()
437 // SAFETY: We just incremented the refcount. This increment is now owned by the new `Arc`. in clone()
444 // SAFETY: By the type invariant, there is necessarily a reference to the object. We cannot in drop()
452 // SAFETY: Also by the type invariant, we are allowed to decrement the refcount. in drop()
457 // SAFETY: The pointer was initialised from the result of `KBox::leak`. in drop()
471 // SAFETY: The type invariants of `Arc` guarantee that the data is pinned. in from()
557 /// # Safety
563 // INVARIANT: The safety requirements guarantee the invariants. in new()
573 /// # Safety
581 // SAFETY: The caller promises that this pointer originates from a call to `into_raw` on an in from_raw()
585 // SAFETY: The caller promises that the value remains valid since the reference count must in from_raw()
594 // SAFETY: The existence of `b` guarantees that the refcount is non-zero. `ManuallyDrop` in from()
607 // SAFETY: By the type invariant, the underlying object is still alive with no mutable in deref()
716 // SAFETY: When init errors/panics, slot will get deallocated but not dropped, in write_init()
719 // SAFETY: All fields have been initialized. in write_init()
725 // SAFETY: When init errors/panics, slot will get deallocated but not dropped, in write_pin_init()
728 // SAFETY: All fields have been initialized. in write_pin_init()
747 // SAFETY: There are no safety requirements for this FFI call. in new_uninit()
755 // SAFETY: The pointer from the `KBox` is valid. in new_uninit()
765 // SAFETY: We just wrote the value to be initialized. in write()
771 /// # Safety
778 // SAFETY: The new `Arc` is taking over `ptr` from `self.inner` (which won't be in assume_init()
786 // SAFETY: The supplied pointer is valid for initialization. in init_with()
788 // SAFETY: Initialization completed successfully. in init_with()
799 // SAFETY: The supplied pointer is valid for initialization and we will later pin the value in pin_init_with()
802 // SAFETY: Initialization completed successfully. in pin_init_with()
811 // SAFETY: It is not possible to move/replace `T` inside a `Pin<UniqueArc<T>>` (unless `T` in from()
827 // SAFETY: By the `Arc` type invariant, there is necessarily a reference to the object, so in deref_mut()