Skip to content

Commit

Permalink
from_ref, from_mut: clarify domain of quantification
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Jun 2, 2024
1 parent cd04000 commit 7953644
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/src/ptr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand All @@ -791,8 +791,8 @@ pub const fn from_ref<T: ?Sized>(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")]
Expand Down

0 comments on commit 7953644

Please sign in to comment.