heading # Unsafety => # Safety in stdlib docs.
This commit is contained in:
@@ -420,7 +420,7 @@ impl fmt::Display for CannotReallocInPlace {
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// # Unsafety
|
/// # Safety
|
||||||
///
|
///
|
||||||
/// The `GlobalAlloc` trait is an `unsafe` trait for a number of reasons, and
|
/// The `GlobalAlloc` trait is an `unsafe` trait for a number of reasons, and
|
||||||
/// implementors must ensure that they adhere to these contracts:
|
/// implementors must ensure that they adhere to these contracts:
|
||||||
@@ -643,7 +643,7 @@ pub unsafe trait GlobalAlloc {
|
|||||||
/// currently allocated via an allocator `a`, then it is legal to
|
/// currently allocated via an allocator `a`, then it is legal to
|
||||||
/// use that layout to deallocate it, i.e., `a.dealloc(ptr, k);`.
|
/// use that layout to deallocate it, i.e., `a.dealloc(ptr, k);`.
|
||||||
///
|
///
|
||||||
/// # Unsafety
|
/// # Safety
|
||||||
///
|
///
|
||||||
/// The `Alloc` trait is an `unsafe` trait for a number of reasons, and
|
/// The `Alloc` trait is an `unsafe` trait for a number of reasons, and
|
||||||
/// implementors must ensure that they adhere to these contracts:
|
/// implementors must ensure that they adhere to these contracts:
|
||||||
|
|||||||
@@ -1173,7 +1173,7 @@ impl<T> MaybeUninit<T> {
|
|||||||
/// to ensure that the data will get dropped, because the resulting `T` is
|
/// to ensure that the data will get dropped, because the resulting `T` is
|
||||||
/// subject to the usual drop handling.
|
/// subject to the usual drop handling.
|
||||||
///
|
///
|
||||||
/// # Unsafety
|
/// # Safety
|
||||||
///
|
///
|
||||||
/// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized
|
/// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized
|
||||||
/// state. Calling this when the content is not yet fully initialized causes undefined
|
/// state. Calling this when the content is not yet fully initialized causes undefined
|
||||||
@@ -1187,7 +1187,7 @@ impl<T> MaybeUninit<T> {
|
|||||||
|
|
||||||
/// Gets a reference to the contained value.
|
/// Gets a reference to the contained value.
|
||||||
///
|
///
|
||||||
/// # Unsafety
|
/// # Safety
|
||||||
///
|
///
|
||||||
/// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized
|
/// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized
|
||||||
/// state. Calling this when the content is not yet fully initialized causes undefined
|
/// state. Calling this when the content is not yet fully initialized causes undefined
|
||||||
@@ -1200,7 +1200,7 @@ impl<T> MaybeUninit<T> {
|
|||||||
|
|
||||||
/// Gets a mutable reference to the contained value.
|
/// Gets a mutable reference to the contained value.
|
||||||
///
|
///
|
||||||
/// # Unsafety
|
/// # Safety
|
||||||
///
|
///
|
||||||
/// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized
|
/// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized
|
||||||
/// state. Calling this when the content is not yet fully initialized causes undefined
|
/// state. Calling this when the content is not yet fully initialized causes undefined
|
||||||
|
|||||||
@@ -2158,7 +2158,7 @@ impl<T> [T] {
|
|||||||
/// This method has no purpose when either input element `T` or output element `U` are
|
/// This method has no purpose when either input element `T` or output element `U` are
|
||||||
/// zero-sized and will return the original slice without splitting anything.
|
/// zero-sized and will return the original slice without splitting anything.
|
||||||
///
|
///
|
||||||
/// # Unsafety
|
/// # Safety
|
||||||
///
|
///
|
||||||
/// This method is essentially a `transmute` with respect to the elements in the returned
|
/// This method is essentially a `transmute` with respect to the elements in the returned
|
||||||
/// middle slice, so all the usual caveats pertaining to `transmute::<T, U>` also apply here.
|
/// middle slice, so all the usual caveats pertaining to `transmute::<T, U>` also apply here.
|
||||||
@@ -2211,7 +2211,7 @@ impl<T> [T] {
|
|||||||
/// This method has no purpose when either input element `T` or output element `U` are
|
/// This method has no purpose when either input element `T` or output element `U` are
|
||||||
/// zero-sized and will return the original slice without splitting anything.
|
/// zero-sized and will return the original slice without splitting anything.
|
||||||
///
|
///
|
||||||
/// # Unsafety
|
/// # Safety
|
||||||
///
|
///
|
||||||
/// This method is essentially a `transmute` with respect to the elements in the returned
|
/// This method is essentially a `transmute` with respect to the elements in the returned
|
||||||
/// middle slice, so all the usual caveats pertaining to `transmute::<T, U>` also apply here.
|
/// middle slice, so all the usual caveats pertaining to `transmute::<T, U>` also apply here.
|
||||||
|
|||||||
Reference in New Issue
Block a user