diff options
Diffstat (limited to 'library/core/src/ptr/mod.rs')
| -rw-r--r-- | library/core/src/ptr/mod.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index 81bf6778b05..fe8c6f83034 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs @@ -398,7 +398,7 @@ use crate::cmp::Ordering; use crate::intrinsics::const_eval_select; -use crate::marker::FnPtr; +use crate::marker::{FnPtr, PointeeSized}; use crate::mem::{self, MaybeUninit, SizedTypeProperties}; use crate::num::NonZero; use crate::{fmt, hash, intrinsics, ub_checks}; @@ -796,7 +796,7 @@ pub const unsafe fn write_bytes<T>(dst: *mut T, val: u8, count: usize) { #[lang = "drop_in_place"] #[allow(unconditional_recursion)] #[rustc_diagnostic_item = "ptr_drop_in_place"] -pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) { +pub unsafe fn drop_in_place<T: PointeeSized>(to_drop: *mut T) { // Code here does not matter - this is replaced by the // real drop glue by the compiler. @@ -825,7 +825,7 @@ pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) { #[rustc_promotable] #[rustc_const_stable(feature = "const_ptr_null", since = "1.24.0")] #[rustc_diagnostic_item = "ptr_null"] -pub const fn null<T: ?Sized + Thin>() -> *const T { +pub const fn null<T: PointeeSized + Thin>() -> *const T { from_raw_parts(without_provenance::<()>(0), ()) } @@ -850,7 +850,7 @@ pub const fn null<T: ?Sized + Thin>() -> *const T { #[rustc_promotable] #[rustc_const_stable(feature = "const_ptr_null", since = "1.24.0")] #[rustc_diagnostic_item = "ptr_null_mut"] -pub const fn null_mut<T: ?Sized + Thin>() -> *mut T { +pub const fn null_mut<T: PointeeSized + Thin>() -> *mut T { from_raw_parts_mut(without_provenance_mut::<()>(0), ()) } @@ -1068,7 +1068,7 @@ pub fn with_exposed_provenance_mut<T>(addr: usize) -> *mut T { #[rustc_const_stable(feature = "ptr_from_ref", since = "1.76.0")] #[rustc_never_returns_null_ptr] #[rustc_diagnostic_item = "ptr_from_ref"] -pub const fn from_ref<T: ?Sized>(r: &T) -> *const T { +pub const fn from_ref<T: PointeeSized>(r: &T) -> *const T { r } @@ -1118,7 +1118,7 @@ pub const fn from_ref<T: ?Sized>(r: &T) -> *const T { #[stable(feature = "ptr_from_ref", since = "1.76.0")] #[rustc_const_stable(feature = "ptr_from_ref", since = "1.76.0")] #[rustc_never_returns_null_ptr] -pub const fn from_mut<T: ?Sized>(r: &mut T) -> *mut T { +pub const fn from_mut<T: PointeeSized>(r: &mut T) -> *mut T { r } @@ -2419,7 +2419,7 @@ pub(crate) unsafe fn align_offset<T: Sized>(p: *const T, a: usize) -> usize { #[must_use = "pointer comparison produces a value"] #[rustc_diagnostic_item = "ptr_eq"] #[allow(ambiguous_wide_pointer_comparisons)] // it's actually clear here -pub fn eq<T: ?Sized>(a: *const T, b: *const T) -> bool { +pub fn eq<T: PointeeSized>(a: *const T, b: *const T) -> bool { a == b } @@ -2443,7 +2443,7 @@ pub fn eq<T: ?Sized>(a: *const T, b: *const T) -> bool { #[stable(feature = "ptr_addr_eq", since = "1.76.0")] #[inline(always)] #[must_use = "pointer comparison produces a value"] -pub fn addr_eq<T: ?Sized, U: ?Sized>(p: *const T, q: *const U) -> bool { +pub fn addr_eq<T: PointeeSized, U: PointeeSized>(p: *const T, q: *const U) -> bool { (p as *const ()) == (q as *const ()) } @@ -2526,7 +2526,7 @@ pub fn fn_addr_eq<T: FnPtr, U: FnPtr>(f: T, g: U) -> bool { /// assert_eq!(actual, expected); /// ``` #[stable(feature = "ptr_hash", since = "1.35.0")] -pub fn hash<T: ?Sized, S: hash::Hasher>(hashee: *const T, into: &mut S) { +pub fn hash<T: PointeeSized, S: hash::Hasher>(hashee: *const T, into: &mut S) { use crate::hash::Hash; hashee.hash(into); } |
