File tree 2 files changed +28
-0
lines changed
2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -57,10 +57,24 @@ impl<T: ?Sized> *const T {
57
57
#[ rustc_const_stable( feature = "const_ptr_cast" , since = "1.38.0" ) ]
58
58
#[ rustc_diagnostic_item = "const_ptr_cast" ]
59
59
#[ inline( always) ]
60
+ #[ cfg( bootstrap) ]
60
61
pub const fn cast < U > ( self ) -> * const U {
61
62
self as _
62
63
}
63
64
65
+ /// Casts to a pointer of another type.
66
+ #[ stable( feature = "ptr_cast" , since = "1.38.0" ) ]
67
+ #[ rustc_const_stable( feature = "const_ptr_cast" , since = "1.38.0" ) ]
68
+ #[ rustc_diagnostic_item = "const_ptr_cast" ]
69
+ #[ inline( always) ]
70
+ #[ cfg( not( bootstrap) ) ]
71
+ pub const fn cast < U : ?Sized > ( self ) -> * const U
72
+ where
73
+ T : PointerCast < U > ,
74
+ {
75
+ self as _
76
+ }
77
+
64
78
/// Use the pointer value in a new pointer of another type.
65
79
///
66
80
/// In case `meta` is a (fat) pointer to an unsized type, this operation
Original file line number Diff line number Diff line change @@ -57,10 +57,24 @@ impl<T: ?Sized> *mut T {
57
57
#[ rustc_const_stable( feature = "const_ptr_cast" , since = "1.38.0" ) ]
58
58
#[ rustc_diagnostic_item = "ptr_cast" ]
59
59
#[ inline( always) ]
60
+ #[ cfg( bootstrap) ]
60
61
pub const fn cast < U > ( self ) -> * mut U {
61
62
self as _
62
63
}
63
64
65
+ /// Casts to a pointer of another type.
66
+ #[ stable( feature = "ptr_cast" , since = "1.38.0" ) ]
67
+ #[ rustc_const_stable( feature = "const_ptr_cast" , since = "1.38.0" ) ]
68
+ #[ rustc_diagnostic_item = "ptr_cast" ]
69
+ #[ inline( always) ]
70
+ #[ cfg( not( bootstrap) ) ]
71
+ pub const fn cast < U : ?Sized > ( self ) -> * mut U
72
+ where
73
+ T : PointerCast < U > ,
74
+ {
75
+ self as _
76
+ }
77
+
64
78
/// Use the pointer value in a new pointer of another type.
65
79
///
66
80
/// In case `meta` is a (fat) pointer to an unsized type, this operation
You can’t perform that action at this time.
0 commit comments