@@ -84,9 +84,6 @@ pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
84
84
unsafe { crate :: ptr:: drop_in_place ( to_drop) }
85
85
}
86
86
87
- #[ cfg( bootstrap) ]
88
- pub use self :: r#try as catch_unwind;
89
-
90
87
extern "rust-intrinsic" {
91
88
// N.B., these intrinsics take raw pointers because they mutate aliased
92
89
// memory, which is not valid for either `&` or `&mut`.
@@ -965,8 +962,7 @@ extern "rust-intrinsic" {
965
962
#[ rustc_const_stable( feature = "const_assume" , since = "1.77.0" ) ]
966
963
#[ rustc_nounwind]
967
964
#[ unstable( feature = "core_intrinsics" , issue = "none" ) ]
968
- #[ cfg_attr( not( bootstrap) , rustc_intrinsic) ]
969
- #[ cfg_attr( bootstrap, inline) ]
965
+ #[ rustc_intrinsic]
970
966
pub const unsafe fn assume ( b : bool ) {
971
967
if !b {
972
968
// SAFETY: the caller must guarantee the argument is never `false`
@@ -987,9 +983,8 @@ pub const unsafe fn assume(b: bool) {
987
983
/// This intrinsic does not have a stable counterpart.
988
984
#[ rustc_const_unstable( feature = "const_likely" , issue = "none" ) ]
989
985
#[ unstable( feature = "core_intrinsics" , issue = "none" ) ]
990
- #[ cfg_attr ( not ( bootstrap ) , rustc_intrinsic) ]
986
+ #[ rustc_intrinsic]
991
987
#[ rustc_nounwind]
992
- #[ cfg_attr( bootstrap, inline) ]
993
988
pub const fn likely ( b : bool ) -> bool {
994
989
b
995
990
}
@@ -1007,9 +1002,8 @@ pub const fn likely(b: bool) -> bool {
1007
1002
/// This intrinsic does not have a stable counterpart.
1008
1003
#[ rustc_const_unstable( feature = "const_likely" , issue = "none" ) ]
1009
1004
#[ unstable( feature = "core_intrinsics" , issue = "none" ) ]
1010
- #[ cfg_attr ( not ( bootstrap ) , rustc_intrinsic) ]
1005
+ #[ rustc_intrinsic]
1011
1006
#[ rustc_nounwind]
1012
- #[ cfg_attr( bootstrap, inline) ]
1013
1007
pub const fn unlikely ( b : bool ) -> bool {
1014
1008
b
1015
1009
}
@@ -1919,39 +1913,34 @@ extern "rust-intrinsic" {
1919
1913
/// This intrinsic does not have a stable counterpart.
1920
1914
#[ rustc_nounwind]
1921
1915
#[ rustc_safe_intrinsic]
1922
- #[ cfg( not( bootstrap) ) ]
1923
1916
pub fn fadd_algebraic < T : Copy > ( a : T , b : T ) -> T ;
1924
1917
1925
1918
/// Float subtraction that allows optimizations based on algebraic rules.
1926
1919
///
1927
1920
/// This intrinsic does not have a stable counterpart.
1928
1921
#[ rustc_nounwind]
1929
1922
#[ rustc_safe_intrinsic]
1930
- #[ cfg( not( bootstrap) ) ]
1931
1923
pub fn fsub_algebraic < T : Copy > ( a : T , b : T ) -> T ;
1932
1924
1933
1925
/// Float multiplication that allows optimizations based on algebraic rules.
1934
1926
///
1935
1927
/// This intrinsic does not have a stable counterpart.
1936
1928
#[ rustc_nounwind]
1937
1929
#[ rustc_safe_intrinsic]
1938
- #[ cfg( not( bootstrap) ) ]
1939
1930
pub fn fmul_algebraic < T : Copy > ( a : T , b : T ) -> T ;
1940
1931
1941
1932
/// Float division that allows optimizations based on algebraic rules.
1942
1933
///
1943
1934
/// This intrinsic does not have a stable counterpart.
1944
1935
#[ rustc_nounwind]
1945
1936
#[ rustc_safe_intrinsic]
1946
- #[ cfg( not( bootstrap) ) ]
1947
1937
pub fn fdiv_algebraic < T : Copy > ( a : T , b : T ) -> T ;
1948
1938
1949
1939
/// Float remainder that allows optimizations based on algebraic rules.
1950
1940
///
1951
1941
/// This intrinsic does not have a stable counterpart.
1952
1942
#[ rustc_nounwind]
1953
1943
#[ rustc_safe_intrinsic]
1954
- #[ cfg( not( bootstrap) ) ]
1955
1944
pub fn frem_algebraic < T : Copy > ( a : T , b : T ) -> T ;
1956
1945
1957
1946
/// Convert with LLVM’s fptoui/fptosi, which may return undef for values out of range
@@ -2407,14 +2396,8 @@ extern "rust-intrinsic" {
2407
2396
///
2408
2397
/// The stable version of this intrinsic is `std::panic::catch_unwind`.
2409
2398
#[ rustc_nounwind]
2410
- #[ cfg( not( bootstrap) ) ]
2411
2399
pub fn catch_unwind ( try_fn : fn ( * mut u8 ) , data : * mut u8 , catch_fn : fn ( * mut u8 , * mut u8 ) ) -> i32 ;
2412
2400
2413
- /// For bootstrap only, see `catch_unwind`.
2414
- #[ rustc_nounwind]
2415
- #[ cfg( bootstrap) ]
2416
- pub fn r#try ( try_fn : fn ( * mut u8 ) , data : * mut u8 , catch_fn : fn ( * mut u8 , * mut u8 ) ) -> i32 ;
2417
-
2418
2401
/// Emits a `!nontemporal` store according to LLVM (see their docs).
2419
2402
/// Probably will never become stable.
2420
2403
///
@@ -2518,9 +2501,9 @@ extern "rust-intrinsic" {
2518
2501
#[ cfg( bootstrap) ]
2519
2502
pub fn vtable_align ( ptr : * const ( ) ) -> usize ;
2520
2503
2521
- #[ cfg( bootstrap) ]
2522
2504
#[ rustc_const_unstable( feature = "const_eval_select" , issue = "none" ) ]
2523
- #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
2505
+ #[ rustc_safe_intrinsic]
2506
+ #[ cfg( bootstrap) ]
2524
2507
pub fn const_eval_select < ARG : Tuple , F , G , RET > (
2525
2508
arg : ARG ,
2526
2509
called_in_const : F ,
@@ -2650,8 +2633,7 @@ where
2650
2633
#[ rustc_const_unstable( feature = "is_val_statically_known" , issue = "none" ) ]
2651
2634
#[ rustc_nounwind]
2652
2635
#[ unstable( feature = "core_intrinsics" , issue = "none" ) ]
2653
- #[ cfg_attr( not( bootstrap) , rustc_intrinsic) ]
2654
- #[ cfg_attr( bootstrap, inline) ]
2636
+ #[ rustc_intrinsic]
2655
2637
pub const fn is_val_statically_known < T : Copy > ( _arg : T ) -> bool {
2656
2638
false
2657
2639
}
@@ -2670,7 +2652,7 @@ pub const fn is_val_statically_known<T: Copy>(_arg: T) -> bool {
2670
2652
#[ rustc_const_unstable( feature = "ub_checks" , issue = "none" ) ]
2671
2653
#[ unstable( feature = "core_intrinsics" , issue = "none" ) ]
2672
2654
#[ inline( always) ]
2673
- #[ cfg_attr ( not ( bootstrap ) , rustc_intrinsic) ]
2655
+ #[ rustc_intrinsic]
2674
2656
pub ( crate ) const fn check_library_ub ( ) -> bool {
2675
2657
cfg ! ( debug_assertions)
2676
2658
}
@@ -2686,7 +2668,7 @@ pub(crate) const fn check_library_ub() -> bool {
2686
2668
#[ rustc_const_unstable( feature = "ub_checks" , issue = "none" ) ]
2687
2669
#[ unstable( feature = "core_intrinsics" , issue = "none" ) ]
2688
2670
#[ inline( always) ]
2689
- #[ cfg_attr ( not ( bootstrap ) , rustc_intrinsic) ]
2671
+ #[ rustc_intrinsic]
2690
2672
pub ( crate ) const fn check_language_ub ( ) -> bool {
2691
2673
cfg ! ( debug_assertions)
2692
2674
}
@@ -2702,8 +2684,7 @@ pub(crate) const fn check_language_ub() -> bool {
2702
2684
#[ rustc_const_unstable( feature = "const_heap" , issue = "79597" ) ]
2703
2685
#[ unstable( feature = "core_intrinsics" , issue = "none" ) ]
2704
2686
#[ rustc_nounwind]
2705
- #[ cfg_attr( not( bootstrap) , rustc_intrinsic) ]
2706
- #[ cfg_attr( bootstrap, inline) ]
2687
+ #[ rustc_intrinsic]
2707
2688
pub const unsafe fn const_allocate ( _size : usize , _align : usize ) -> * mut u8 {
2708
2689
// const eval overrides this function, but runtime code should always just return null pointers.
2709
2690
crate :: ptr:: null_mut ( )
@@ -2722,8 +2703,7 @@ pub const unsafe fn const_allocate(_size: usize, _align: usize) -> *mut u8 {
2722
2703
#[ rustc_const_unstable( feature = "const_heap" , issue = "79597" ) ]
2723
2704
#[ unstable( feature = "core_intrinsics" , issue = "none" ) ]
2724
2705
#[ rustc_nounwind]
2725
- #[ cfg_attr( not( bootstrap) , rustc_intrinsic) ]
2726
- #[ cfg_attr( bootstrap, inline) ]
2706
+ #[ rustc_intrinsic]
2727
2707
pub const unsafe fn const_deallocate ( _ptr : * mut u8 , _size : usize , _align : usize ) { }
2728
2708
2729
2709
/// `ptr` must point to a vtable.
@@ -2799,15 +2779,6 @@ pub unsafe fn vtable_align(_ptr: *const ()) -> usize {
2799
2779
macro_rules! assert_unsafe_precondition {
2800
2780
( $kind: ident, $message: expr, ( $( $name: ident: $ty: ty = $arg: expr) ,* $( , ) ?) => $e: expr $( , ) ?) => {
2801
2781
{
2802
- // #[cfg(bootstrap)] (this comment)
2803
- // When the standard library is compiled with debug assertions, we want the check to inline for better performance.
2804
- // This is important when working on the compiler, which is compiled with debug assertions locally.
2805
- // When not compiled with debug assertions (so the precompiled std) we outline the check to minimize the compile
2806
- // time impact when debug assertions are disabled.
2807
- // The proper solution to this is the `#[rustc_no_mir_inline]` below, but we still want decent performance for cfg(bootstrap).
2808
- #[ cfg_attr( all( debug_assertions, bootstrap) , inline( always) ) ]
2809
- #[ cfg_attr( all( not( debug_assertions) , bootstrap) , inline( never) ) ]
2810
-
2811
2782
// This check is inlineable, but not by the MIR inliner.
2812
2783
// The reason for this is that the MIR inliner is in an exceptionally bad position
2813
2784
// to think about whether or not to inline this. In MIR, this call is gated behind `debug_assertions`,
@@ -2816,8 +2787,8 @@ macro_rules! assert_unsafe_precondition {
2816
2787
//
2817
2788
// LLVM on the other hand sees the constant branch, so if it's `false`, it can immediately delete it without
2818
2789
// inlining the check. If it's `true`, it can inline it and get significantly better performance.
2819
- #[ cfg_attr ( not ( bootstrap ) , rustc_no_mir_inline) ]
2820
- #[ cfg_attr ( not ( bootstrap ) , inline) ]
2790
+ #[ rustc_no_mir_inline]
2791
+ #[ inline]
2821
2792
#[ rustc_nounwind]
2822
2793
#[ rustc_const_unstable( feature = "ub_checks" , issue = "none" ) ]
2823
2794
const fn precondition_check( $( $name: $ty) ,* ) {
@@ -2885,13 +2856,7 @@ pub(crate) const fn is_nonoverlapping(
2885
2856
true
2886
2857
}
2887
2858
2888
- #[ cfg_attr( not( bootstrap) , allow( unused_unsafe) ) ] // on bootstrap bump, remove unsafe block
2889
- // SAFETY: This function's precondition is equivalent to that of `const_eval_select`.
2890
- // Programs which do not execute UB will only see this function return `true`, which makes the
2891
- // const and runtime implementation indistinguishable.
2892
- unsafe {
2893
- const_eval_select ( ( src, dst, size, count) , comptime, runtime)
2894
- }
2859
+ const_eval_select ( ( src, dst, size, count) , comptime, runtime)
2895
2860
}
2896
2861
2897
2862
/// Copies `count * size_of::<T>()` bytes from `src` to `dst`. The source
@@ -3208,9 +3173,5 @@ pub(crate) const fn miri_promise_symbolic_alignment(ptr: *const (), align: usize
3208
3173
3209
3174
const fn compiletime ( _ptr : * const ( ) , _align : usize ) { }
3210
3175
3211
- #[ cfg_attr( not( bootstrap) , allow( unused_unsafe) ) ] // on bootstrap bump, remove unsafe block
3212
- // SAFETY: the extra behavior at runtime is for UB checks only.
3213
- unsafe {
3214
- const_eval_select ( ( ptr, align) , compiletime, runtime) ;
3215
- }
3176
+ const_eval_select ( ( ptr, align) , compiletime, runtime) ;
3216
3177
}
0 commit comments