@@ -788,6 +788,7 @@ extern "rust-intrinsic" {
788
788
/// uninitialized at that point in the control flow.
789
789
///
790
790
/// This intrinsic should not be used outside of the compiler.
791
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
791
792
pub fn rustc_peek < T > ( _: T ) -> T ;
792
793
793
794
/// Aborts the execution of the process.
@@ -805,6 +806,7 @@ extern "rust-intrinsic" {
805
806
/// On Unix, the
806
807
/// process will probably terminate with a signal like `SIGABRT`, `SIGILL`, `SIGTRAP`, `SIGSEGV` or
807
808
/// `SIGBUS`. The precise behaviour is not guaranteed and not stable.
809
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
808
810
pub fn abort ( ) -> !;
809
811
810
812
/// Informs the optimizer that this point in the code is not reachable,
@@ -843,6 +845,7 @@ extern "rust-intrinsic" {
843
845
///
844
846
/// This intrinsic does not have a stable counterpart.
845
847
#[ rustc_const_unstable( feature = "const_likely" , issue = "none" ) ]
848
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
846
849
pub fn likely ( b : bool ) -> bool ;
847
850
848
851
/// Hints to the compiler that branch condition is likely to be false.
@@ -857,6 +860,7 @@ extern "rust-intrinsic" {
857
860
///
858
861
/// This intrinsic does not have a stable counterpart.
859
862
#[ rustc_const_unstable( feature = "const_likely" , issue = "none" ) ]
863
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
860
864
pub fn unlikely ( b : bool ) -> bool ;
861
865
862
866
/// Executes a breakpoint trap, for inspection by a debugger.
@@ -876,6 +880,7 @@ extern "rust-intrinsic" {
876
880
///
877
881
/// The stabilized version of this intrinsic is [`core::mem::size_of`].
878
882
#[ rustc_const_stable( feature = "const_size_of" , since = "1.40.0" ) ]
883
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
879
884
pub fn size_of < T > ( ) -> usize ;
880
885
881
886
/// The minimum alignment of a type.
@@ -887,6 +892,7 @@ extern "rust-intrinsic" {
887
892
///
888
893
/// The stabilized version of this intrinsic is [`core::mem::align_of`].
889
894
#[ rustc_const_stable( feature = "const_min_align_of" , since = "1.40.0" ) ]
895
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
890
896
pub fn min_align_of < T > ( ) -> usize ;
891
897
/// The preferred alignment of a type.
892
898
///
@@ -915,6 +921,7 @@ extern "rust-intrinsic" {
915
921
///
916
922
/// The stabilized version of this intrinsic is [`core::any::type_name`].
917
923
#[ rustc_const_unstable( feature = "const_type_name" , issue = "63084" ) ]
924
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
918
925
pub fn type_name < T : ?Sized > ( ) -> & ' static str ;
919
926
920
927
/// Gets an identifier which is globally unique to the specified type. This
@@ -928,27 +935,31 @@ extern "rust-intrinsic" {
928
935
///
929
936
/// The stabilized version of this intrinsic is [`core::any::TypeId::of`].
930
937
#[ rustc_const_unstable( feature = "const_type_id" , issue = "77125" ) ]
938
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
931
939
pub fn type_id < T : ?Sized + ' static > ( ) -> u64 ;
932
940
933
941
/// A guard for unsafe functions that cannot ever be executed if `T` is uninhabited:
934
942
/// This will statically either panic, or do nothing.
935
943
///
936
944
/// This intrinsic does not have a stable counterpart.
937
945
#[ rustc_const_stable( feature = "const_assert_type" , since = "1.59.0" ) ]
946
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
938
947
pub fn assert_inhabited < T > ( ) ;
939
948
940
949
/// A guard for unsafe functions that cannot ever be executed if `T` does not permit
941
950
/// zero-initialization: This will statically either panic, or do nothing.
942
951
///
943
952
/// This intrinsic does not have a stable counterpart.
944
953
#[ rustc_const_unstable( feature = "const_assert_type2" , issue = "none" ) ]
954
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
945
955
pub fn assert_zero_valid < T > ( ) ;
946
956
947
957
/// A guard for unsafe functions that cannot ever be executed if `T` has invalid
948
958
/// bit patterns: This will statically either panic, or do nothing.
949
959
///
950
960
/// This intrinsic does not have a stable counterpart.
951
961
#[ rustc_const_unstable( feature = "const_assert_type2" , issue = "none" ) ]
962
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
952
963
pub fn assert_uninit_valid < T > ( ) ;
953
964
954
965
/// Gets a reference to a static `Location` indicating where it was called.
@@ -960,6 +971,7 @@ extern "rust-intrinsic" {
960
971
///
961
972
/// Consider using [`core::panic::Location::caller`] instead.
962
973
#[ rustc_const_unstable( feature = "const_caller_location" , issue = "76156" ) ]
974
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
963
975
pub fn caller_location ( ) -> & ' static crate :: panic:: Location < ' static > ;
964
976
965
977
/// Moves a value out of scope without running drop glue.
@@ -972,6 +984,7 @@ extern "rust-intrinsic" {
972
984
/// Therefore, implementations must not require the user to uphold
973
985
/// any safety invariants.
974
986
#[ rustc_const_unstable( feature = "const_intrinsic_forget" , issue = "none" ) ]
987
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
975
988
pub fn forget < T : ?Sized > ( _: T ) ;
976
989
977
990
/// Reinterprets the bits of a value of one type as another type.
@@ -1251,6 +1264,7 @@ extern "rust-intrinsic" {
1251
1264
///
1252
1265
/// The stabilized version of this intrinsic is [`mem::needs_drop`](crate::mem::needs_drop).
1253
1266
#[ rustc_const_stable( feature = "const_needs_drop" , since = "1.40.0" ) ]
1267
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
1254
1268
pub fn needs_drop < T : ?Sized > ( ) -> bool ;
1255
1269
1256
1270
/// Calculates the offset from a pointer.
@@ -1295,6 +1309,7 @@ extern "rust-intrinsic" {
1295
1309
/// any safety invariants.
1296
1310
///
1297
1311
/// Consider using [`pointer::mask`] instead.
1312
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
1298
1313
pub fn ptr_mask < T > ( ptr : * const T , mask : usize ) -> * const T ;
1299
1314
1300
1315
/// Equivalent to the appropriate `llvm.memcpy.p0i8.0i8.*` intrinsic, with
@@ -1486,6 +1501,7 @@ extern "rust-intrinsic" {
1486
1501
///
1487
1502
/// The stabilized version of this intrinsic is
1488
1503
/// [`f32::min`]
1504
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
1489
1505
pub fn minnumf32 ( x : f32 , y : f32 ) -> f32 ;
1490
1506
/// Returns the minimum of two `f64` values.
1491
1507
///
@@ -1496,6 +1512,7 @@ extern "rust-intrinsic" {
1496
1512
///
1497
1513
/// The stabilized version of this intrinsic is
1498
1514
/// [`f64::min`]
1515
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
1499
1516
pub fn minnumf64 ( x : f64 , y : f64 ) -> f64 ;
1500
1517
/// Returns the maximum of two `f32` values.
1501
1518
///
@@ -1506,6 +1523,7 @@ extern "rust-intrinsic" {
1506
1523
///
1507
1524
/// The stabilized version of this intrinsic is
1508
1525
/// [`f32::max`]
1526
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
1509
1527
pub fn maxnumf32 ( x : f32 , y : f32 ) -> f32 ;
1510
1528
/// Returns the maximum of two `f64` values.
1511
1529
///
@@ -1516,6 +1534,7 @@ extern "rust-intrinsic" {
1516
1534
///
1517
1535
/// The stabilized version of this intrinsic is
1518
1536
/// [`f64::max`]
1537
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
1519
1538
pub fn maxnumf64 ( x : f64 , y : f64 ) -> f64 ;
1520
1539
1521
1540
/// Copies the sign from `y` to `x` for `f32` values.
@@ -1636,6 +1655,7 @@ extern "rust-intrinsic" {
1636
1655
/// primitives via the `count_ones` method. For example,
1637
1656
/// [`u32::count_ones`]
1638
1657
#[ rustc_const_stable( feature = "const_ctpop" , since = "1.40.0" ) ]
1658
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
1639
1659
pub fn ctpop < T : Copy > ( x : T ) -> T ;
1640
1660
1641
1661
/// Returns the number of leading unset bits (zeroes) in an integer type `T`.
@@ -1673,6 +1693,7 @@ extern "rust-intrinsic" {
1673
1693
/// assert_eq!(num_leading, 16);
1674
1694
/// ```
1675
1695
#[ rustc_const_stable( feature = "const_ctlz" , since = "1.40.0" ) ]
1696
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
1676
1697
pub fn ctlz < T : Copy > ( x : T ) -> T ;
1677
1698
1678
1699
/// Like `ctlz`, but extra-unsafe as it returns `undef` when
@@ -1729,6 +1750,7 @@ extern "rust-intrinsic" {
1729
1750
/// assert_eq!(num_trailing, 16);
1730
1751
/// ```
1731
1752
#[ rustc_const_stable( feature = "const_cttz" , since = "1.40.0" ) ]
1753
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
1732
1754
pub fn cttz < T : Copy > ( x : T ) -> T ;
1733
1755
1734
1756
/// Like `cttz`, but extra-unsafe as it returns `undef` when
@@ -1761,6 +1783,7 @@ extern "rust-intrinsic" {
1761
1783
/// primitives via the `swap_bytes` method. For example,
1762
1784
/// [`u32::swap_bytes`]
1763
1785
#[ rustc_const_stable( feature = "const_bswap" , since = "1.40.0" ) ]
1786
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
1764
1787
pub fn bswap < T : Copy > ( x : T ) -> T ;
1765
1788
1766
1789
/// Reverses the bits in an integer type `T`.
@@ -1774,6 +1797,7 @@ extern "rust-intrinsic" {
1774
1797
/// primitives via the `reverse_bits` method. For example,
1775
1798
/// [`u32::reverse_bits`]
1776
1799
#[ rustc_const_stable( feature = "const_bitreverse" , since = "1.40.0" ) ]
1800
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
1777
1801
pub fn bitreverse < T : Copy > ( x : T ) -> T ;
1778
1802
1779
1803
/// Performs checked integer addition.
@@ -1787,6 +1811,7 @@ extern "rust-intrinsic" {
1787
1811
/// primitives via the `overflowing_add` method. For example,
1788
1812
/// [`u32::overflowing_add`]
1789
1813
#[ rustc_const_stable( feature = "const_int_overflow" , since = "1.40.0" ) ]
1814
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
1790
1815
pub fn add_with_overflow < T : Copy > ( x : T , y : T ) -> ( T , bool ) ;
1791
1816
1792
1817
/// Performs checked integer subtraction
@@ -1800,6 +1825,7 @@ extern "rust-intrinsic" {
1800
1825
/// primitives via the `overflowing_sub` method. For example,
1801
1826
/// [`u32::overflowing_sub`]
1802
1827
#[ rustc_const_stable( feature = "const_int_overflow" , since = "1.40.0" ) ]
1828
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
1803
1829
pub fn sub_with_overflow < T : Copy > ( x : T , y : T ) -> ( T , bool ) ;
1804
1830
1805
1831
/// Performs checked integer multiplication
@@ -1813,6 +1839,7 @@ extern "rust-intrinsic" {
1813
1839
/// primitives via the `overflowing_mul` method. For example,
1814
1840
/// [`u32::overflowing_mul`]
1815
1841
#[ rustc_const_stable( feature = "const_int_overflow" , since = "1.40.0" ) ]
1842
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
1816
1843
pub fn mul_with_overflow < T : Copy > ( x : T , y : T ) -> ( T , bool ) ;
1817
1844
1818
1845
/// Performs an exact division, resulting in undefined behavior where
@@ -1887,6 +1914,7 @@ extern "rust-intrinsic" {
1887
1914
/// primitives via the `rotate_left` method. For example,
1888
1915
/// [`u32::rotate_left`]
1889
1916
#[ rustc_const_stable( feature = "const_int_rotate" , since = "1.40.0" ) ]
1917
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
1890
1918
pub fn rotate_left < T : Copy > ( x : T , y : T ) -> T ;
1891
1919
1892
1920
/// Performs rotate right.
@@ -1900,6 +1928,7 @@ extern "rust-intrinsic" {
1900
1928
/// primitives via the `rotate_right` method. For example,
1901
1929
/// [`u32::rotate_right`]
1902
1930
#[ rustc_const_stable( feature = "const_int_rotate" , since = "1.40.0" ) ]
1931
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
1903
1932
pub fn rotate_right < T : Copy > ( x : T , y : T ) -> T ;
1904
1933
1905
1934
/// Returns (a + b) mod 2<sup>N</sup>, where N is the width of T in bits.
@@ -1913,6 +1942,7 @@ extern "rust-intrinsic" {
1913
1942
/// primitives via the `wrapping_add` method. For example,
1914
1943
/// [`u32::wrapping_add`]
1915
1944
#[ rustc_const_stable( feature = "const_int_wrapping" , since = "1.40.0" ) ]
1945
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
1916
1946
pub fn wrapping_add < T : Copy > ( a : T , b : T ) -> T ;
1917
1947
/// Returns (a - b) mod 2<sup>N</sup>, where N is the width of T in bits.
1918
1948
///
@@ -1925,6 +1955,7 @@ extern "rust-intrinsic" {
1925
1955
/// primitives via the `wrapping_sub` method. For example,
1926
1956
/// [`u32::wrapping_sub`]
1927
1957
#[ rustc_const_stable( feature = "const_int_wrapping" , since = "1.40.0" ) ]
1958
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
1928
1959
pub fn wrapping_sub < T : Copy > ( a : T , b : T ) -> T ;
1929
1960
/// Returns (a * b) mod 2<sup>N</sup>, where N is the width of T in bits.
1930
1961
///
@@ -1937,6 +1968,7 @@ extern "rust-intrinsic" {
1937
1968
/// primitives via the `wrapping_mul` method. For example,
1938
1969
/// [`u32::wrapping_mul`]
1939
1970
#[ rustc_const_stable( feature = "const_int_wrapping" , since = "1.40.0" ) ]
1971
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
1940
1972
pub fn wrapping_mul < T : Copy > ( a : T , b : T ) -> T ;
1941
1973
1942
1974
/// Computes `a + b`, saturating at numeric bounds.
@@ -1950,6 +1982,7 @@ extern "rust-intrinsic" {
1950
1982
/// primitives via the `saturating_add` method. For example,
1951
1983
/// [`u32::saturating_add`]
1952
1984
#[ rustc_const_stable( feature = "const_int_saturating" , since = "1.40.0" ) ]
1985
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
1953
1986
pub fn saturating_add < T : Copy > ( a : T , b : T ) -> T ;
1954
1987
/// Computes `a - b`, saturating at numeric bounds.
1955
1988
///
@@ -1962,6 +1995,7 @@ extern "rust-intrinsic" {
1962
1995
/// primitives via the `saturating_sub` method. For example,
1963
1996
/// [`u32::saturating_sub`]
1964
1997
#[ rustc_const_stable( feature = "const_int_saturating" , since = "1.40.0" ) ]
1998
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
1965
1999
pub fn saturating_sub < T : Copy > ( a : T , b : T ) -> T ;
1966
2000
1967
2001
/// Returns the value of the discriminant for the variant in 'v';
@@ -1974,6 +2008,7 @@ extern "rust-intrinsic" {
1974
2008
///
1975
2009
/// The stabilized version of this intrinsic is [`core::mem::discriminant`].
1976
2010
#[ rustc_const_unstable( feature = "const_discriminant" , issue = "69821" ) ]
2011
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
1977
2012
pub fn discriminant_value < T > ( v : & T ) -> <T as DiscriminantKind >:: Discriminant ;
1978
2013
1979
2014
/// Returns the number of variants of the type `T` cast to a `usize`;
@@ -1986,6 +2021,7 @@ extern "rust-intrinsic" {
1986
2021
///
1987
2022
/// The to-be-stabilized version of this intrinsic is [`mem::variant_count`].
1988
2023
#[ rustc_const_unstable( feature = "variant_count" , issue = "73662" ) ]
2024
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
1989
2025
pub fn variant_count < T > ( ) -> usize ;
1990
2026
1991
2027
/// Rust's "try catch" construct which invokes the function pointer `try_fn`
@@ -2019,6 +2055,7 @@ extern "rust-intrinsic" {
2019
2055
/// Therefore, implementations must not require the user to uphold
2020
2056
/// any safety invariants.
2021
2057
#[ rustc_const_unstable( feature = "const_raw_ptr_comparison" , issue = "53020" ) ]
2058
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
2022
2059
pub fn ptr_guaranteed_cmp < T > ( ptr : * const T , other : * const T ) -> u8 ;
2023
2060
2024
2061
/// Allocates a block of memory at compile time.
@@ -2069,6 +2106,7 @@ extern "rust-intrinsic" {
2069
2106
///
2070
2107
/// [`std::hint::black_box`]: crate::hint::black_box
2071
2108
#[ rustc_const_unstable( feature = "const_black_box" , issue = "none" ) ]
2109
+ #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
2072
2110
pub fn black_box < T > ( dummy : T ) -> T ;
2073
2111
2074
2112
/// `ptr` must point to a vtable.
0 commit comments