@@ -178,14 +178,11 @@ impl<T: ?Sized> *const T {
178
178
#[ must_use]
179
179
#[ inline]
180
180
#[ unstable( feature = "strict_provenance" , issue = "95228" ) ]
181
- pub fn addr ( self ) -> usize
182
- where
183
- T : Sized ,
184
- {
181
+ pub fn addr ( self ) -> usize {
185
182
// FIXME(strict_provenance_magic): I am magic and should be a compiler intrinsic.
186
183
// SAFETY: Pointer-to-integer transmutes are valid (if you are okay with losing the
187
184
// provenance).
188
- unsafe { mem:: transmute ( self ) }
185
+ unsafe { mem:: transmute ( self . cast :: < ( ) > ( ) ) }
189
186
}
190
187
191
188
/// Gets the "address" portion of the pointer, and 'exposes' the "provenance" part for future
@@ -215,12 +212,9 @@ impl<T: ?Sized> *const T {
215
212
#[ must_use]
216
213
#[ inline]
217
214
#[ 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 {
222
216
// FIXME(strict_provenance_magic): I am magic and should be a compiler intrinsic.
223
- self as usize
217
+ self . cast :: < ( ) > ( ) as usize
224
218
}
225
219
226
220
/// Creates a new pointer with the given address.
@@ -238,10 +232,7 @@ impl<T: ?Sized> *const T {
238
232
#[ must_use]
239
233
#[ inline]
240
234
#[ 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 {
245
236
// FIXME(strict_provenance_magic): I am magic and should be a compiler intrinsic.
246
237
//
247
238
// In the mean-time, this operation is defined to be "as if" it was
@@ -264,10 +255,7 @@ impl<T: ?Sized> *const T {
264
255
#[ must_use]
265
256
#[ inline]
266
257
#[ 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 {
271
259
self . with_addr ( f ( self . addr ( ) ) )
272
260
}
273
261
0 commit comments