diff --git a/library/core/src/alloc/layout.rs b/library/core/src/alloc/layout.rs index 66f5310db8310..9c0517c3ee2f8 100644 --- a/library/core/src/alloc/layout.rs +++ b/library/core/src/alloc/layout.rs @@ -226,7 +226,9 @@ impl Layout { /// /// # Safety /// - /// This function is only safe to call if the following conditions hold: + /// This function is safe to call if the pointer is safe to reborrow as `&T` + /// (in which case you could also call [`for_value`][Self::for_value]). + /// Otherwise, the following conditions must hold: /// /// - If `T` is `Sized`, this function is always safe to call. /// - If the unsized tail of `T` is: diff --git a/library/core/src/mem/alignment.rs b/library/core/src/mem/alignment.rs index 8f453685a6f92..4b0d7e96a38d1 100644 --- a/library/core/src/mem/alignment.rs +++ b/library/core/src/mem/alignment.rs @@ -114,7 +114,9 @@ impl Alignment { /// /// # Safety /// - /// This function is only safe to call if the following conditions hold: + /// This function is safe to call if the pointer is safe to reborrow as `&T` + /// (in which case you could also call [`of_val`][Self::of_val]). + /// Otherwise, the following conditions must hold: /// /// - If `T` is `Sized`, this function is always safe to call. /// - If the unsized tail of `T` is: diff --git a/library/core/src/mem/mod.rs b/library/core/src/mem/mod.rs index e24b220acb43b..9c453d9607b29 100644 --- a/library/core/src/mem/mod.rs +++ b/library/core/src/mem/mod.rs @@ -419,7 +419,9 @@ pub const fn size_of_val(val: &T) -> usize { /// /// # Safety /// -/// This function is only safe to call if the following conditions hold: +/// This function is safe to call if the pointer is safe to reborrow as `&T` +/// (in which case you could also call [`size_of_val`]). +/// Otherwise, the following conditions must hold: /// /// - If `T` is `Sized`, this function is always safe to call. /// - If the unsized tail of `T` is: @@ -592,7 +594,9 @@ pub const fn align_of_val(val: &T) -> usize { /// /// # Safety /// -/// This function is only safe to call if the following conditions hold: +/// This function is safe to call if the pointer is safe to reborrow as `&T` +/// (in which case you could also call [`align_of_val`]). +/// Otherwise, the following conditions must hold: /// /// - If `T` is `Sized`, this function is always safe to call. /// - If the unsized tail of `T` is: