Skip to content

Commit 7953644

Browse files
committed
from_ref, from_mut: clarify domain of quantification
1 parent cd04000 commit 7953644

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/src/ptr/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -777,8 +777,8 @@ where
777777

778778
/// Convert a reference to a raw pointer.
779779
///
780-
/// This is equivalent to `r as *const T`, but is a bit safer since it will never silently change
781-
/// type or mutability, in particular if the code is refactored.
780+
/// For `r: &T`, `from_ref(r)` is equivalent to `r as *const T`, but is a bit safer since it will
781+
/// never silently change type or mutability, in particular if the code is refactored.
782782
#[inline(always)]
783783
#[must_use]
784784
#[stable(feature = "ptr_from_ref", since = "1.76.0")]
@@ -791,8 +791,8 @@ pub const fn from_ref<T: ?Sized>(r: &T) -> *const T {
791791

792792
/// Convert a mutable reference to a raw pointer.
793793
///
794-
/// This is equivalent to `r as *mut T`, but is a bit safer since it will never silently change
795-
/// type or mutability, in particular if the code is refactored.
794+
/// For `r: &mut T`, `from_mut(r)` is equivalent to `r as *mut T`, but is a bit safer since it will
795+
/// never silently change type or mutability, in particular if the code is refactored.
796796
#[inline(always)]
797797
#[must_use]
798798
#[stable(feature = "ptr_from_ref", since = "1.76.0")]

0 commit comments

Comments
 (0)