@@ -178,14 +178,11 @@ impl<T: ?Sized> *const T {
178178 #[ must_use]
179179 #[ inline]
180180 #[ unstable( feature = "strict_provenance" , issue = "95228" ) ]
181- pub fn addr ( self ) -> usize
182- where
183- T : Sized ,
184- {
181+ pub fn addr ( self ) -> usize {
185182 // FIXME(strict_provenance_magic): I am magic and should be a compiler intrinsic.
186183 // SAFETY: Pointer-to-integer transmutes are valid (if you are okay with losing the
187184 // provenance).
188- unsafe { mem:: transmute ( self ) }
185+ unsafe { mem:: transmute ( self . cast :: < ( ) > ( ) ) }
189186 }
190187
191188 /// Gets the "address" portion of the pointer, and 'exposes' the "provenance" part for future
@@ -215,12 +212,9 @@ impl<T: ?Sized> *const T {
215212 #[ must_use]
216213 #[ inline]
217214 #[ unstable( feature = "strict_provenance" , issue = "95228" ) ]
218- pub fn expose_addr ( self ) -> usize
219- where
220- T : Sized ,
221- {
215+ pub fn expose_addr ( self ) -> usize {
222216 // FIXME(strict_provenance_magic): I am magic and should be a compiler intrinsic.
223- self as usize
217+ self . cast :: < ( ) > ( ) as usize
224218 }
225219
226220 /// Creates a new pointer with the given address.
@@ -238,10 +232,7 @@ impl<T: ?Sized> *const T {
238232 #[ must_use]
239233 #[ inline]
240234 #[ unstable( feature = "strict_provenance" , issue = "95228" ) ]
241- pub fn with_addr ( self , addr : usize ) -> Self
242- where
243- T : Sized ,
244- {
235+ pub fn with_addr ( self , addr : usize ) -> Self {
245236 // FIXME(strict_provenance_magic): I am magic and should be a compiler intrinsic.
246237 //
247238 // In the mean-time, this operation is defined to be "as if" it was
@@ -264,10 +255,7 @@ impl<T: ?Sized> *const T {
264255 #[ must_use]
265256 #[ inline]
266257 #[ unstable( feature = "strict_provenance" , issue = "95228" ) ]
267- pub fn map_addr ( self , f : impl FnOnce ( usize ) -> usize ) -> Self
268- where
269- T : Sized ,
270- {
258+ pub fn map_addr ( self , f : impl FnOnce ( usize ) -> usize ) -> Self {
271259 self . with_addr ( f ( self . addr ( ) ) )
272260 }
273261
0 commit comments