Skip to content

Commit 662f1f2

Browse files
committed
Lift T: Sized bounds from some strict_provenance NonNull methods
1 parent 1f34e11 commit 662f1f2

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

library/core/src/ptr/non_null.rs

+3-12
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,7 @@ impl<T: ?Sized> NonNull<T> {
268268
#[must_use]
269269
#[inline]
270270
#[unstable(feature = "strict_provenance", issue = "95228")]
271-
pub fn addr(self) -> NonZeroUsize
272-
where
273-
T: Sized,
274-
{
271+
pub fn addr(self) -> NonZeroUsize {
275272
// SAFETY: The pointer is guaranteed by the type to be non-null,
276273
// meaning that the address will be non-zero.
277274
unsafe { NonZeroUsize::new_unchecked(self.pointer.addr()) }
@@ -286,10 +283,7 @@ impl<T: ?Sized> NonNull<T> {
286283
#[must_use]
287284
#[inline]
288285
#[unstable(feature = "strict_provenance", issue = "95228")]
289-
pub fn with_addr(self, addr: NonZeroUsize) -> Self
290-
where
291-
T: Sized,
292-
{
286+
pub fn with_addr(self, addr: NonZeroUsize) -> Self {
293287
// SAFETY: The result of `ptr::from::with_addr` is non-null because `addr` is guaranteed to be non-zero.
294288
unsafe { NonNull::new_unchecked(self.pointer.with_addr(addr.get()) as *mut _) }
295289
}
@@ -303,10 +297,7 @@ impl<T: ?Sized> NonNull<T> {
303297
#[must_use]
304298
#[inline]
305299
#[unstable(feature = "strict_provenance", issue = "95228")]
306-
pub fn map_addr(self, f: impl FnOnce(NonZeroUsize) -> NonZeroUsize) -> Self
307-
where
308-
T: Sized,
309-
{
300+
pub fn map_addr(self, f: impl FnOnce(NonZeroUsize) -> NonZeroUsize) -> Self {
310301
self.with_addr(f(self.addr()))
311302
}
312303

0 commit comments

Comments
 (0)