@@ -947,7 +947,6 @@ extern "rust-intrinsic" {
947
947
#[ rustc_const_stable( feature = "const_unreachable_unchecked" , since = "1.57.0" ) ]
948
948
#[ rustc_nounwind]
949
949
pub fn unreachable ( ) -> !;
950
-
951
950
}
952
951
953
952
/// Informs the optimizer that a condition is always true.
@@ -1018,78 +1017,40 @@ extern "rust-intrinsic" {
1018
1017
#[ rustc_nounwind]
1019
1018
pub fn breakpoint ( ) ;
1020
1019
1021
- /// The size of a type in bytes.
1022
- ///
1023
- /// Note that, unlike most intrinsics, this is safe to call;
1024
- /// it does not require an `unsafe` block.
1025
- /// Therefore, implementations must not require the user to uphold
1026
- /// any safety invariants.
1027
- ///
1028
- /// More specifically, this is the offset in bytes between successive
1029
- /// items of the same type, including alignment padding.
1030
- ///
1031
- /// The stabilized version of this intrinsic is [`core::mem::size_of`].
1020
+ #[ cfg( bootstrap) ]
1032
1021
#[ rustc_const_stable( feature = "const_size_of" , since = "1.40.0" ) ]
1033
1022
#[ rustc_safe_intrinsic]
1034
1023
#[ rustc_nounwind]
1035
1024
pub fn size_of < T > ( ) -> usize ;
1036
1025
1037
- /// The minimum alignment of a type.
1038
- ///
1039
- /// Note that, unlike most intrinsics, this is safe to call;
1040
- /// it does not require an `unsafe` block.
1041
- /// Therefore, implementations must not require the user to uphold
1042
- /// any safety invariants.
1043
- ///
1044
- /// The stabilized version of this intrinsic is [`core::mem::align_of`].
1026
+ #[ cfg( bootstrap) ]
1045
1027
#[ rustc_const_stable( feature = "const_min_align_of" , since = "1.40.0" ) ]
1046
1028
#[ rustc_safe_intrinsic]
1047
1029
#[ rustc_nounwind]
1048
1030
pub fn min_align_of < T > ( ) -> usize ;
1049
- /// The preferred alignment of a type.
1050
- ///
1051
- /// This intrinsic does not have a stable counterpart.
1052
- /// It's "tracking issue" is [#91971](https://github.com/rust-lang/rust/issues/91971).
1031
+
1032
+ #[ cfg( bootstrap) ]
1053
1033
#[ rustc_const_unstable( feature = "const_pref_align_of" , issue = "91971" ) ]
1054
1034
#[ rustc_nounwind]
1055
1035
pub fn pref_align_of < T > ( ) -> usize ;
1056
1036
1057
- /// The size of the referenced value in bytes.
1058
- ///
1059
- /// The stabilized version of this intrinsic is [`crate::mem::size_of_val`].
1037
+ #[ cfg( bootstrap) ]
1060
1038
#[ rustc_const_unstable( feature = "const_size_of_val" , issue = "46571" ) ]
1061
1039
#[ rustc_nounwind]
1062
1040
pub fn size_of_val < T : ?Sized > ( _: * const T ) -> usize ;
1063
- /// The required alignment of the referenced value.
1064
- ///
1065
- /// The stabilized version of this intrinsic is [`core::mem::align_of_val`].
1041
+
1042
+ #[ cfg( bootstrap) ]
1066
1043
#[ rustc_const_unstable( feature = "const_align_of_val" , issue = "46571" ) ]
1067
1044
#[ rustc_nounwind]
1068
1045
pub fn min_align_of_val < T : ?Sized > ( _: * const T ) -> usize ;
1069
1046
1070
- /// Gets a static string slice containing the name of a type.
1071
- ///
1072
- /// Note that, unlike most intrinsics, this is safe to call;
1073
- /// it does not require an `unsafe` block.
1074
- /// Therefore, implementations must not require the user to uphold
1075
- /// any safety invariants.
1076
- ///
1077
- /// The stabilized version of this intrinsic is [`core::any::type_name`].
1047
+ #[ cfg( bootstrap) ]
1078
1048
#[ rustc_const_unstable( feature = "const_type_name" , issue = "63084" ) ]
1079
1049
#[ rustc_safe_intrinsic]
1080
1050
#[ rustc_nounwind]
1081
1051
pub fn type_name < T : ?Sized > ( ) -> & ' static str ;
1082
1052
1083
- /// Gets an identifier which is globally unique to the specified type. This
1084
- /// function will return the same value for a type regardless of whichever
1085
- /// crate it is invoked in.
1086
- ///
1087
- /// Note that, unlike most intrinsics, this is safe to call;
1088
- /// it does not require an `unsafe` block.
1089
- /// Therefore, implementations must not require the user to uphold
1090
- /// any safety invariants.
1091
- ///
1092
- /// The stabilized version of this intrinsic is [`core::any::TypeId::of`].
1053
+ #[ cfg( bootstrap) ]
1093
1054
#[ rustc_const_unstable( feature = "const_type_id" , issue = "77125" ) ]
1094
1055
#[ rustc_safe_intrinsic]
1095
1056
#[ rustc_nounwind]
@@ -2424,15 +2385,7 @@ extern "rust-intrinsic" {
2424
2385
#[ rustc_nounwind]
2425
2386
pub fn discriminant_value < T > ( v : & T ) -> <T as DiscriminantKind >:: Discriminant ;
2426
2387
2427
- /// Returns the number of variants of the type `T` cast to a `usize`;
2428
- /// if `T` has no variants, returns `0`. Uninhabited variants will be counted.
2429
- ///
2430
- /// Note that, unlike most intrinsics, this is safe to call;
2431
- /// it does not require an `unsafe` block.
2432
- /// Therefore, implementations must not require the user to uphold
2433
- /// any safety invariants.
2434
- ///
2435
- /// The to-be-stabilized version of this intrinsic is [`crate::mem::variant_count`].
2388
+ #[ cfg( bootstrap) ]
2436
2389
#[ rustc_const_unstable( feature = "variant_count" , issue = "73662" ) ]
2437
2390
#[ rustc_safe_intrinsic]
2438
2391
#[ rustc_nounwind]
@@ -2793,6 +2746,142 @@ pub unsafe fn vtable_align(_ptr: *const ()) -> usize {
2793
2746
unreachable ! ( )
2794
2747
}
2795
2748
2749
+ /// The size of a type in bytes.
2750
+ ///
2751
+ /// Note that, unlike most intrinsics, this is safe to call;
2752
+ /// it does not require an `unsafe` block.
2753
+ /// Therefore, implementations must not require the user to uphold
2754
+ /// any safety invariants.
2755
+ ///
2756
+ /// More specifically, this is the offset in bytes between successive
2757
+ /// items of the same type, including alignment padding.
2758
+ ///
2759
+ /// The stabilized version of this intrinsic is [`core::mem::size_of`].
2760
+ #[ rustc_nounwind]
2761
+ #[ unstable( feature = "core_intrinsics" , issue = "none" ) ]
2762
+ #[ rustc_const_stable( feature = "const_size_of" , since = "1.40.0" ) ]
2763
+ #[ rustc_intrinsic]
2764
+ #[ rustc_intrinsic_must_be_overridden]
2765
+ #[ cfg( not( bootstrap) ) ]
2766
+ pub const fn size_of < T > ( ) -> usize {
2767
+ unreachable ! ( )
2768
+ }
2769
+
2770
+ /// The minimum alignment of a type.
2771
+ ///
2772
+ /// Note that, unlike most intrinsics, this is safe to call;
2773
+ /// it does not require an `unsafe` block.
2774
+ /// Therefore, implementations must not require the user to uphold
2775
+ /// any safety invariants.
2776
+ ///
2777
+ /// The stabilized version of this intrinsic is [`core::mem::align_of`].
2778
+ #[ rustc_nounwind]
2779
+ #[ unstable( feature = "core_intrinsics" , issue = "none" ) ]
2780
+ #[ rustc_const_stable( feature = "const_min_align_of" , since = "1.40.0" ) ]
2781
+ #[ rustc_intrinsic]
2782
+ #[ rustc_intrinsic_must_be_overridden]
2783
+ #[ cfg( not( bootstrap) ) ]
2784
+ pub const fn min_align_of < T > ( ) -> usize {
2785
+ unreachable ! ( )
2786
+ }
2787
+
2788
+ /// The preferred alignment of a type.
2789
+ ///
2790
+ /// This intrinsic does not have a stable counterpart.
2791
+ /// It's "tracking issue" is [#91971](https://github.com/rust-lang/rust/issues/91971).
2792
+ #[ rustc_nounwind]
2793
+ #[ unstable( feature = "core_intrinsics" , issue = "none" ) ]
2794
+ #[ rustc_const_unstable( feature = "const_pref_align_of" , issue = "91971" ) ]
2795
+ #[ rustc_intrinsic]
2796
+ #[ rustc_intrinsic_must_be_overridden]
2797
+ #[ cfg( not( bootstrap) ) ]
2798
+ pub const unsafe fn pref_align_of < T > ( ) -> usize {
2799
+ unreachable ! ( )
2800
+ }
2801
+
2802
+ /// Returns the number of variants of the type `T` cast to a `usize`;
2803
+ /// if `T` has no variants, returns `0`. Uninhabited variants will be counted.
2804
+ ///
2805
+ /// Note that, unlike most intrinsics, this is safe to call;
2806
+ /// it does not require an `unsafe` block.
2807
+ /// Therefore, implementations must not require the user to uphold
2808
+ /// any safety invariants.
2809
+ ///
2810
+ /// The to-be-stabilized version of this intrinsic is [`crate::mem::variant_count`].
2811
+ #[ rustc_nounwind]
2812
+ #[ unstable( feature = "core_intrinsics" , issue = "none" ) ]
2813
+ #[ rustc_const_unstable( feature = "variant_count" , issue = "73662" ) ]
2814
+ #[ rustc_intrinsic]
2815
+ #[ rustc_intrinsic_must_be_overridden]
2816
+ #[ cfg( not( bootstrap) ) ]
2817
+ pub const fn variant_count < T > ( ) -> usize {
2818
+ unreachable ! ( )
2819
+ }
2820
+
2821
+ /// The size of the referenced value in bytes.
2822
+ ///
2823
+ /// The stabilized version of this intrinsic is [`crate::mem::size_of_val`].
2824
+ #[ rustc_nounwind]
2825
+ #[ unstable( feature = "core_intrinsics" , issue = "none" ) ]
2826
+ #[ rustc_const_unstable( feature = "const_size_of_val" , issue = "46571" ) ]
2827
+ #[ rustc_intrinsic]
2828
+ #[ rustc_intrinsic_must_be_overridden]
2829
+ #[ cfg( not( bootstrap) ) ]
2830
+ pub const unsafe fn size_of_val < T : ?Sized > ( _ptr : * const T ) -> usize {
2831
+ unreachable ! ( )
2832
+ }
2833
+
2834
+ /// The required alignment of the referenced value.
2835
+ ///
2836
+ /// The stabilized version of this intrinsic is [`core::mem::align_of_val`].
2837
+ #[ rustc_nounwind]
2838
+ #[ unstable( feature = "core_intrinsics" , issue = "none" ) ]
2839
+ #[ rustc_const_unstable( feature = "const_align_of_val" , issue = "46571" ) ]
2840
+ #[ rustc_intrinsic]
2841
+ #[ rustc_intrinsic_must_be_overridden]
2842
+ #[ cfg( not( bootstrap) ) ]
2843
+ pub const unsafe fn min_align_of_val < T : ?Sized > ( _ptr : * const T ) -> usize {
2844
+ unreachable ! ( )
2845
+ }
2846
+
2847
+ /// Gets a static string slice containing the name of a type.
2848
+ ///
2849
+ /// Note that, unlike most intrinsics, this is safe to call;
2850
+ /// it does not require an `unsafe` block.
2851
+ /// Therefore, implementations must not require the user to uphold
2852
+ /// any safety invariants.
2853
+ ///
2854
+ /// The stabilized version of this intrinsic is [`core::any::type_name`].
2855
+ #[ rustc_nounwind]
2856
+ #[ unstable( feature = "core_intrinsics" , issue = "none" ) ]
2857
+ #[ rustc_const_unstable( feature = "const_type_name" , issue = "63084" ) ]
2858
+ #[ rustc_intrinsic]
2859
+ #[ rustc_intrinsic_must_be_overridden]
2860
+ #[ cfg( not( bootstrap) ) ]
2861
+ pub const fn type_name < T : ?Sized > ( ) -> & ' static str {
2862
+ unreachable ! ( )
2863
+ }
2864
+
2865
+ /// Gets an identifier which is globally unique to the specified type. This
2866
+ /// function will return the same value for a type regardless of whichever
2867
+ /// crate it is invoked in.
2868
+ ///
2869
+ /// Note that, unlike most intrinsics, this is safe to call;
2870
+ /// it does not require an `unsafe` block.
2871
+ /// Therefore, implementations must not require the user to uphold
2872
+ /// any safety invariants.
2873
+ ///
2874
+ /// The stabilized version of this intrinsic is [`core::any::TypeId::of`].
2875
+ #[ rustc_nounwind]
2876
+ #[ unstable( feature = "core_intrinsics" , issue = "none" ) ]
2877
+ #[ rustc_const_unstable( feature = "const_type_id" , issue = "77125" ) ]
2878
+ #[ rustc_intrinsic]
2879
+ #[ rustc_intrinsic_must_be_overridden]
2880
+ #[ cfg( not( bootstrap) ) ]
2881
+ pub const fn type_id < T : ?Sized + ' static > ( ) -> u128 {
2882
+ unreachable ! ( )
2883
+ }
2884
+
2796
2885
/// Lowers in MIR to `Rvalue::Aggregate` with `AggregateKind::RawPtr`.
2797
2886
///
2798
2887
/// This is used to implement functions like `slice::from_raw_parts_mut` and
0 commit comments