From 7953644ececf01b24c5d3d24b6b793488f04cc3d Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 2 Jun 2024 16:43:29 +0200 Subject: [PATCH] from_ref, from_mut: clarify domain of quantification --- core/src/ptr/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/ptr/mod.rs b/core/src/ptr/mod.rs index 8e3447d0b1b24..f1a1b1a414935 100644 --- a/core/src/ptr/mod.rs +++ b/core/src/ptr/mod.rs @@ -777,8 +777,8 @@ where /// Convert a reference to a raw pointer. /// -/// This is equivalent to `r as *const T`, but is a bit safer since it will never silently change -/// type or mutability, in particular if the code is refactored. +/// For `r: &T`, `from_ref(r)` is equivalent to `r as *const T`, but is a bit safer since it will +/// never silently change type or mutability, in particular if the code is refactored. #[inline(always)] #[must_use] #[stable(feature = "ptr_from_ref", since = "1.76.0")] @@ -791,8 +791,8 @@ pub const fn from_ref(r: &T) -> *const T { /// Convert a mutable reference to a raw pointer. /// -/// This is equivalent to `r as *mut T`, but is a bit safer since it will never silently change -/// type or mutability, in particular if the code is refactored. +/// For `r: &mut T`, `from_mut(r)` is equivalent to `r as *mut T`, but is a bit safer since it will +/// never silently change type or mutability, in particular if the code is refactored. #[inline(always)] #[must_use] #[stable(feature = "ptr_from_ref", since = "1.76.0")]