@@ -667,14 +667,17 @@ extern "rust-intrinsic" {
667
667
///
668
668
/// The stabilized version of this intrinsic is
669
669
/// [`std::mem::size_of`](../../std/mem/fn.size_of.html).
670
+ #[ rustc_const_stable( feature = "const_size_of" , since = "1.40.0" ) ]
670
671
pub fn size_of < T > ( ) -> usize ;
671
672
672
673
/// Moves a value to an uninitialized memory location.
673
674
///
674
675
/// Drop glue is not run on the destination.
675
676
pub fn move_val_init < T > ( dst : * mut T , src : T ) ;
676
677
678
+ #[ rustc_const_stable( feature = "const_min_align_of" , since = "1.40.0" ) ]
677
679
pub fn min_align_of < T > ( ) -> usize ;
680
+ #[ rustc_const_unstable( feature = "const_pref_align_of" , issue = "0" ) ]
678
681
pub fn pref_align_of < T > ( ) -> usize ;
679
682
680
683
/// The size of the referenced value in bytes.
@@ -685,18 +688,21 @@ extern "rust-intrinsic" {
685
688
pub fn min_align_of_val < T : ?Sized > ( _: & T ) -> usize ;
686
689
687
690
/// Gets a static string slice containing the name of a type.
691
+ #[ rustc_const_unstable( feature = "const_type_name" , issue = "0" ) ]
688
692
pub fn type_name < T : ?Sized > ( ) -> & ' static str ;
689
693
690
694
/// Gets an identifier which is globally unique to the specified type. This
691
695
/// function will return the same value for a type regardless of whichever
692
696
/// crate it is invoked in.
697
+ #[ rustc_const_unstable( feature = "const_type_id" , issue = "0" ) ]
693
698
pub fn type_id < T : ?Sized + ' static > ( ) -> u64 ;
694
699
695
700
/// A guard for unsafe functions that cannot ever be executed if `T` is uninhabited:
696
701
/// This will statically either panic, or do nothing.
697
702
pub fn panic_if_uninhabited < T > ( ) ;
698
703
699
704
/// Gets a reference to a static `Location` indicating where it was called.
705
+ #[ rustc_const_unstable( feature = "const_caller_location" , issue = "47809" ) ]
700
706
pub fn caller_location ( ) -> & ' static crate :: panic:: Location < ' static > ;
701
707
702
708
/// Creates a value initialized to zero.
@@ -951,6 +957,7 @@ extern "rust-intrinsic" {
951
957
///
952
958
/// The stabilized version of this intrinsic is
953
959
/// [`std::mem::needs_drop`](../../std/mem/fn.needs_drop.html).
960
+ #[ rustc_const_stable( feature = "const_needs_drop" , since = "1.40.0" ) ]
954
961
pub fn needs_drop < T > ( ) -> bool ;
955
962
956
963
/// Calculates the offset from a pointer.
@@ -1150,6 +1157,7 @@ extern "rust-intrinsic" {
1150
1157
1151
1158
1152
1159
/// Returns the number of bits set in an integer type `T`
1160
+ #[ rustc_const_stable( feature = "const_ctpop" , since = "1.40.0" ) ]
1153
1161
pub fn ctpop < T > ( x : T ) -> T ;
1154
1162
1155
1163
/// Returns the number of leading unset bits (zeroes) in an integer type `T`.
@@ -1177,6 +1185,7 @@ extern "rust-intrinsic" {
1177
1185
/// let num_leading = ctlz(x);
1178
1186
/// assert_eq!(num_leading, 16);
1179
1187
/// ```
1188
+ #[ rustc_const_stable( feature = "const_ctlz" , since = "1.40.0" ) ]
1180
1189
pub fn ctlz < T > ( x : T ) -> T ;
1181
1190
1182
1191
/// Like `ctlz`, but extra-unsafe as it returns `undef` when
@@ -1193,6 +1202,7 @@ extern "rust-intrinsic" {
1193
1202
/// let num_leading = unsafe { ctlz_nonzero(x) };
1194
1203
/// assert_eq!(num_leading, 3);
1195
1204
/// ```
1205
+ #[ rustc_const_unstable( feature = "constctlz" , issue = "0" ) ]
1196
1206
pub fn ctlz_nonzero < T > ( x : T ) -> T ;
1197
1207
1198
1208
/// Returns the number of trailing unset bits (zeroes) in an integer type `T`.
@@ -1220,6 +1230,7 @@ extern "rust-intrinsic" {
1220
1230
/// let num_trailing = cttz(x);
1221
1231
/// assert_eq!(num_trailing, 16);
1222
1232
/// ```
1233
+ #[ rustc_const_stable( feature = "const_cttz" , since = "1.40.0" ) ]
1223
1234
pub fn cttz < T > ( x : T ) -> T ;
1224
1235
1225
1236
/// Like `cttz`, but extra-unsafe as it returns `undef` when
@@ -1236,30 +1247,36 @@ extern "rust-intrinsic" {
1236
1247
/// let num_trailing = unsafe { cttz_nonzero(x) };
1237
1248
/// assert_eq!(num_trailing, 3);
1238
1249
/// ```
1250
+ #[ rustc_const_unstable( feature = "const_cttz" , issue = "0" ) ]
1239
1251
pub fn cttz_nonzero < T > ( x : T ) -> T ;
1240
1252
1241
1253
/// Reverses the bytes in an integer type `T`.
1254
+ #[ rustc_const_stable( feature = "const_bswap" , since = "1.40.0" ) ]
1242
1255
pub fn bswap < T > ( x : T ) -> T ;
1243
1256
1244
1257
/// Reverses the bits in an integer type `T`.
1258
+ #[ rustc_const_stable( feature = "const_bitreverse" , since = "1.40.0" ) ]
1245
1259
pub fn bitreverse < T > ( x : T ) -> T ;
1246
1260
1247
1261
/// Performs checked integer addition.
1248
1262
/// The stabilized versions of this intrinsic are available on the integer
1249
1263
/// primitives via the `overflowing_add` method. For example,
1250
1264
/// [`std::u32::overflowing_add`](../../std/primitive.u32.html#method.overflowing_add)
1265
+ #[ rustc_const_stable( feature = "const_int_overflow" , since = "1.40.0" ) ]
1251
1266
pub fn add_with_overflow < T > ( x : T , y : T ) -> ( T , bool ) ;
1252
1267
1253
1268
/// Performs checked integer subtraction
1254
1269
/// The stabilized versions of this intrinsic are available on the integer
1255
1270
/// primitives via the `overflowing_sub` method. For example,
1256
1271
/// [`std::u32::overflowing_sub`](../../std/primitive.u32.html#method.overflowing_sub)
1272
+ #[ rustc_const_stable( feature = "const_int_overflow" , since = "1.40.0" ) ]
1257
1273
pub fn sub_with_overflow < T > ( x : T , y : T ) -> ( T , bool ) ;
1258
1274
1259
1275
/// Performs checked integer multiplication
1260
1276
/// The stabilized versions of this intrinsic are available on the integer
1261
1277
/// primitives via the `overflowing_mul` method. For example,
1262
1278
/// [`std::u32::overflowing_mul`](../../std/primitive.u32.html#method.overflowing_mul)
1279
+ #[ rustc_const_stable( feature = "const_int_overflow" , since = "1.40.0" ) ]
1263
1280
pub fn mul_with_overflow < T > ( x : T , y : T ) -> ( T , bool ) ;
1264
1281
1265
1282
/// Performs an exact division, resulting in undefined behavior where
@@ -1275,9 +1292,11 @@ extern "rust-intrinsic" {
1275
1292
1276
1293
/// Performs an unchecked left shift, resulting in undefined behavior when
1277
1294
/// y < 0 or y >= N, where N is the width of T in bits.
1295
+ #[ rustc_const_stable( feature = "const_int_unchecked" , since = "1.40.0" ) ]
1278
1296
pub fn unchecked_shl < T > ( x : T , y : T ) -> T ;
1279
1297
/// Performs an unchecked right shift, resulting in undefined behavior when
1280
1298
/// y < 0 or y >= N, where N is the width of T in bits.
1299
+ #[ rustc_const_stable( feature = "const_int_unchecked" , since = "1.40.0" ) ]
1281
1300
pub fn unchecked_shr < T > ( x : T , y : T ) -> T ;
1282
1301
1283
1302
/// Returns the result of an unchecked addition, resulting in
@@ -1296,39 +1315,46 @@ extern "rust-intrinsic" {
1296
1315
/// The stabilized versions of this intrinsic are available on the integer
1297
1316
/// primitives via the `rotate_left` method. For example,
1298
1317
/// [`std::u32::rotate_left`](../../std/primitive.u32.html#method.rotate_left)
1318
+ #[ rustc_const_stable( feature = "const_int_rotate" , since = "1.40.0" ) ]
1299
1319
pub fn rotate_left < T > ( x : T , y : T ) -> T ;
1300
1320
1301
1321
/// Performs rotate right.
1302
1322
/// The stabilized versions of this intrinsic are available on the integer
1303
1323
/// primitives via the `rotate_right` method. For example,
1304
- /// [`std::u32::rotate_right`](../../std/primitive.u32.html#method.rotate_right)
1324
+ /// [`std::u32::rotate_right`](../../std/primitive.u32.html#method.rotate_right
1325
+ #[ rustc_const_stable( feature = "const_int_rotate" , since = "1.40.0" ) ]
1305
1326
pub fn rotate_right < T > ( x : T , y : T ) -> T ;
1306
1327
1307
1328
/// Returns (a + b) mod 2<sup>N</sup>, where N is the width of T in bits.
1308
1329
/// The stabilized versions of this intrinsic are available on the integer
1309
1330
/// primitives via the `wrapping_add` method. For example,
1310
1331
/// [`std::u32::wrapping_add`](../../std/primitive.u32.html#method.wrapping_add)
1332
+ #[ rustc_const_stable( feature = "const_int_wrapping" , since = "1.40.0" ) ]
1311
1333
pub fn wrapping_add < T > ( a : T , b : T ) -> T ;
1312
1334
/// Returns (a - b) mod 2<sup>N</sup>, where N is the width of T in bits.
1313
1335
/// The stabilized versions of this intrinsic are available on the integer
1314
1336
/// primitives via the `wrapping_sub` method. For example,
1315
1337
/// [`std::u32::wrapping_sub`](../../std/primitive.u32.html#method.wrapping_sub)
1338
+ #[ rustc_const_stable( feature = "const_int_wrapping" , since = "1.40.0" ) ]
1316
1339
pub fn wrapping_sub < T > ( a : T , b : T ) -> T ;
1317
1340
/// Returns (a * b) mod 2<sup>N</sup>, where N is the width of T in bits.
1318
1341
/// The stabilized versions of this intrinsic are available on the integer
1319
1342
/// primitives via the `wrapping_mul` method. For example,
1320
1343
/// [`std::u32::wrapping_mul`](../../std/primitive.u32.html#method.wrapping_mul)
1344
+ #[ rustc_const_stable( feature = "const_int_wrapping" , since = "1.40.0" ) ]
1321
1345
pub fn wrapping_mul < T > ( a : T , b : T ) -> T ;
1322
1346
1323
1347
/// Computes `a + b`, while saturating at numeric bounds.
1324
1348
/// The stabilized versions of this intrinsic are available on the integer
1325
1349
/// primitives via the `saturating_add` method. For example,
1326
1350
/// [`std::u32::saturating_add`](../../std/primitive.u32.html#method.saturating_add)
1351
+ #[ rustc_const_stable( feature = "const_int_saturating" , since = "1.40.0" ) ]
1327
1352
pub fn saturating_add < T > ( a : T , b : T ) -> T ;
1328
1353
/// Computes `a - b`, while saturating at numeric bounds.
1329
1354
/// The stabilized versions of this intrinsic are available on the integer
1330
1355
/// primitives via the `saturating_sub` method. For example,
1331
1356
/// [`std::u32::saturating_sub`](../../std/primitive.u32.html#method.saturating_sub)
1357
+ #[ rustc_const_stable( feature = "const_int_saturating" , since = "1.40.0" ) ]
1332
1358
pub fn saturating_sub < T > ( a : T , b : T ) -> T ;
1333
1359
1334
1360
/// Returns the value of the discriminant for the variant in 'v',
@@ -1350,6 +1376,7 @@ extern "rust-intrinsic" {
1350
1376
pub fn nontemporal_store < T > ( ptr : * mut T , val : T ) ;
1351
1377
1352
1378
/// See documentation of `<*const T>::offset_from` for details.
1379
+ #[ rustc_const_unstable( feature = "const_ptr_offset_from" , issue = "0" ) ]
1353
1380
pub fn ptr_offset_from < T > ( ptr : * const T , base : * const T ) -> isize ;
1354
1381
1355
1382
/// Internal hook used by Miri to implement unwinding.
0 commit comments