@@ -45,7 +45,7 @@ impl<T: ?Sized> *const T {
45
45
/// Casts to a pointer of another type.
46
46
#[ stable( feature = "ptr_cast" , since = "1.38.0" ) ]
47
47
#[ rustc_const_stable( feature = "const_ptr_cast" , since = "1.38.0" ) ]
48
- #[ inline]
48
+ #[ inline( always ) ]
49
49
pub const fn cast < U > ( self ) -> * const U {
50
50
self as _
51
51
}
@@ -95,6 +95,7 @@ impl<T: ?Sized> *const T {
95
95
/// refactored.
96
96
#[ stable( feature = "ptr_const_cast" , since = "1.65.0" ) ]
97
97
#[ rustc_const_stable( feature = "ptr_const_cast" , since = "1.65.0" ) ]
98
+ #[ inline( always) ]
98
99
pub const fn cast_mut ( self ) -> * mut T {
99
100
self as _
100
101
}
@@ -126,6 +127,7 @@ impl<T: ?Sized> *const T {
126
127
note = "replaced by the `exposed_addr` method, or update your code \
127
128
to follow the strict provenance rules using its APIs"
128
129
) ]
130
+ #[ inline( always) ]
129
131
pub fn to_bits ( self ) -> usize
130
132
where
131
133
T : Sized ,
@@ -155,6 +157,7 @@ impl<T: ?Sized> *const T {
155
157
your code to follow the strict provenance rules using its APIs"
156
158
) ]
157
159
#[ allow( fuzzy_provenance_casts) ] // this is an unstable and semi-deprecated cast function
160
+ #[ inline( always) ]
158
161
pub fn from_bits ( bits : usize ) -> Self
159
162
where
160
163
T : Sized ,
@@ -186,7 +189,7 @@ impl<T: ?Sized> *const T {
186
189
/// might change in the future (including possibly weakening this so it becomes wholly
187
190
/// equivalent to `self as usize`). See the [module documentation][crate::ptr] for details.
188
191
#[ must_use]
189
- #[ inline]
192
+ #[ inline( always ) ]
190
193
#[ unstable( feature = "strict_provenance" , issue = "95228" ) ]
191
194
pub fn addr ( self ) -> usize
192
195
where
@@ -223,7 +226,7 @@ impl<T: ?Sized> *const T {
223
226
///
224
227
/// [`from_exposed_addr`]: from_exposed_addr
225
228
#[ must_use]
226
- #[ inline]
229
+ #[ inline( always ) ]
227
230
#[ unstable( feature = "strict_provenance" , issue = "95228" ) ]
228
231
pub fn expose_addr ( self ) -> usize
229
232
where
0 commit comments