@@ -84,9 +84,6 @@ pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
8484 unsafe { crate :: ptr:: drop_in_place ( to_drop) }
8585}
8686
87- #[ cfg( bootstrap) ]
88- pub use self :: r#try as catch_unwind;
89-
9087extern "rust-intrinsic" {
9188 // N.B., these intrinsics take raw pointers because they mutate aliased
9289 // memory, which is not valid for either `&` or `&mut`.
@@ -965,8 +962,7 @@ extern "rust-intrinsic" {
965962#[ rustc_const_stable( feature = "const_assume" , since = "1.77.0" ) ]
966963#[ rustc_nounwind]
967964#[ unstable( feature = "core_intrinsics" , issue = "none" ) ]
968- #[ cfg_attr( not( bootstrap) , rustc_intrinsic) ]
969- #[ cfg_attr( bootstrap, inline) ]
965+ #[ rustc_intrinsic]
970966pub const unsafe fn assume ( b : bool ) {
971967 if !b {
972968 // SAFETY: the caller must guarantee the argument is never `false`
@@ -987,9 +983,8 @@ pub const unsafe fn assume(b: bool) {
987983/// This intrinsic does not have a stable counterpart.
988984#[ rustc_const_unstable( feature = "const_likely" , issue = "none" ) ]
989985#[ unstable( feature = "core_intrinsics" , issue = "none" ) ]
990- #[ cfg_attr ( not ( bootstrap ) , rustc_intrinsic) ]
986+ #[ rustc_intrinsic]
991987#[ rustc_nounwind]
992- #[ cfg_attr( bootstrap, inline) ]
993988pub const fn likely ( b : bool ) -> bool {
994989 b
995990}
@@ -1007,9 +1002,8 @@ pub const fn likely(b: bool) -> bool {
10071002/// This intrinsic does not have a stable counterpart.
10081003#[ rustc_const_unstable( feature = "const_likely" , issue = "none" ) ]
10091004#[ unstable( feature = "core_intrinsics" , issue = "none" ) ]
1010- #[ cfg_attr ( not ( bootstrap ) , rustc_intrinsic) ]
1005+ #[ rustc_intrinsic]
10111006#[ rustc_nounwind]
1012- #[ cfg_attr( bootstrap, inline) ]
10131007pub const fn unlikely ( b : bool ) -> bool {
10141008 b
10151009}
@@ -1919,39 +1913,34 @@ extern "rust-intrinsic" {
19191913 /// This intrinsic does not have a stable counterpart.
19201914 #[ rustc_nounwind]
19211915 #[ rustc_safe_intrinsic]
1922- #[ cfg( not( bootstrap) ) ]
19231916 pub fn fadd_algebraic < T : Copy > ( a : T , b : T ) -> T ;
19241917
19251918 /// Float subtraction that allows optimizations based on algebraic rules.
19261919 ///
19271920 /// This intrinsic does not have a stable counterpart.
19281921 #[ rustc_nounwind]
19291922 #[ rustc_safe_intrinsic]
1930- #[ cfg( not( bootstrap) ) ]
19311923 pub fn fsub_algebraic < T : Copy > ( a : T , b : T ) -> T ;
19321924
19331925 /// Float multiplication that allows optimizations based on algebraic rules.
19341926 ///
19351927 /// This intrinsic does not have a stable counterpart.
19361928 #[ rustc_nounwind]
19371929 #[ rustc_safe_intrinsic]
1938- #[ cfg( not( bootstrap) ) ]
19391930 pub fn fmul_algebraic < T : Copy > ( a : T , b : T ) -> T ;
19401931
19411932 /// Float division that allows optimizations based on algebraic rules.
19421933 ///
19431934 /// This intrinsic does not have a stable counterpart.
19441935 #[ rustc_nounwind]
19451936 #[ rustc_safe_intrinsic]
1946- #[ cfg( not( bootstrap) ) ]
19471937 pub fn fdiv_algebraic < T : Copy > ( a : T , b : T ) -> T ;
19481938
19491939 /// Float remainder that allows optimizations based on algebraic rules.
19501940 ///
19511941 /// This intrinsic does not have a stable counterpart.
19521942 #[ rustc_nounwind]
19531943 #[ rustc_safe_intrinsic]
1954- #[ cfg( not( bootstrap) ) ]
19551944 pub fn frem_algebraic < T : Copy > ( a : T , b : T ) -> T ;
19561945
19571946 /// Convert with LLVM’s fptoui/fptosi, which may return undef for values out of range
@@ -2407,14 +2396,8 @@ extern "rust-intrinsic" {
24072396 ///
24082397 /// The stable version of this intrinsic is `std::panic::catch_unwind`.
24092398 #[ rustc_nounwind]
2410- #[ cfg( not( bootstrap) ) ]
24112399 pub fn catch_unwind ( try_fn : fn ( * mut u8 ) , data : * mut u8 , catch_fn : fn ( * mut u8 , * mut u8 ) ) -> i32 ;
24122400
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-
24182401 /// Emits a `!nontemporal` store according to LLVM (see their docs).
24192402 /// Probably will never become stable.
24202403 ///
@@ -2518,9 +2501,9 @@ extern "rust-intrinsic" {
25182501 #[ cfg( bootstrap) ]
25192502 pub fn vtable_align ( ptr : * const ( ) ) -> usize ;
25202503
2521- #[ cfg( bootstrap) ]
25222504 #[ rustc_const_unstable( feature = "const_eval_select" , issue = "none" ) ]
2523- #[ cfg_attr( not( bootstrap) , rustc_safe_intrinsic) ]
2505+ #[ rustc_safe_intrinsic]
2506+ #[ cfg( bootstrap) ]
25242507 pub fn const_eval_select < ARG : Tuple , F , G , RET > (
25252508 arg : ARG ,
25262509 called_in_const : F ,
@@ -2650,8 +2633,7 @@ where
26502633#[ rustc_const_unstable( feature = "is_val_statically_known" , issue = "none" ) ]
26512634#[ rustc_nounwind]
26522635#[ unstable( feature = "core_intrinsics" , issue = "none" ) ]
2653- #[ cfg_attr( not( bootstrap) , rustc_intrinsic) ]
2654- #[ cfg_attr( bootstrap, inline) ]
2636+ #[ rustc_intrinsic]
26552637pub const fn is_val_statically_known < T : Copy > ( _arg : T ) -> bool {
26562638 false
26572639}
@@ -2670,7 +2652,7 @@ pub const fn is_val_statically_known<T: Copy>(_arg: T) -> bool {
26702652#[ rustc_const_unstable( feature = "ub_checks" , issue = "none" ) ]
26712653#[ unstable( feature = "core_intrinsics" , issue = "none" ) ]
26722654#[ inline( always) ]
2673- #[ cfg_attr ( not ( bootstrap ) , rustc_intrinsic) ]
2655+ #[ rustc_intrinsic]
26742656pub ( crate ) const fn check_library_ub ( ) -> bool {
26752657 cfg ! ( debug_assertions)
26762658}
@@ -2686,7 +2668,7 @@ pub(crate) const fn check_library_ub() -> bool {
26862668#[ rustc_const_unstable( feature = "ub_checks" , issue = "none" ) ]
26872669#[ unstable( feature = "core_intrinsics" , issue = "none" ) ]
26882670#[ inline( always) ]
2689- #[ cfg_attr ( not ( bootstrap ) , rustc_intrinsic) ]
2671+ #[ rustc_intrinsic]
26902672pub ( crate ) const fn check_language_ub ( ) -> bool {
26912673 cfg ! ( debug_assertions)
26922674}
@@ -2702,8 +2684,7 @@ pub(crate) const fn check_language_ub() -> bool {
27022684#[ rustc_const_unstable( feature = "const_heap" , issue = "79597" ) ]
27032685#[ unstable( feature = "core_intrinsics" , issue = "none" ) ]
27042686#[ rustc_nounwind]
2705- #[ cfg_attr( not( bootstrap) , rustc_intrinsic) ]
2706- #[ cfg_attr( bootstrap, inline) ]
2687+ #[ rustc_intrinsic]
27072688pub const unsafe fn const_allocate ( _size : usize , _align : usize ) -> * mut u8 {
27082689 // const eval overrides this function, but runtime code should always just return null pointers.
27092690 crate :: ptr:: null_mut ( )
@@ -2722,8 +2703,7 @@ pub const unsafe fn const_allocate(_size: usize, _align: usize) -> *mut u8 {
27222703#[ rustc_const_unstable( feature = "const_heap" , issue = "79597" ) ]
27232704#[ unstable( feature = "core_intrinsics" , issue = "none" ) ]
27242705#[ rustc_nounwind]
2725- #[ cfg_attr( not( bootstrap) , rustc_intrinsic) ]
2726- #[ cfg_attr( bootstrap, inline) ]
2706+ #[ rustc_intrinsic]
27272707pub const unsafe fn const_deallocate ( _ptr : * mut u8 , _size : usize , _align : usize ) { }
27282708
27292709/// `ptr` must point to a vtable.
@@ -2799,15 +2779,6 @@ pub unsafe fn vtable_align(_ptr: *const ()) -> usize {
27992779macro_rules! assert_unsafe_precondition {
28002780 ( $kind: ident, $message: expr, ( $( $name: ident: $ty: ty = $arg: expr) ,* $( , ) ?) => $e: expr $( , ) ?) => {
28012781 {
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-
28112782 // This check is inlineable, but not by the MIR inliner.
28122783 // The reason for this is that the MIR inliner is in an exceptionally bad position
28132784 // 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 {
28162787 //
28172788 // LLVM on the other hand sees the constant branch, so if it's `false`, it can immediately delete it without
28182789 // 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]
28212792 #[ rustc_nounwind]
28222793 #[ rustc_const_unstable( feature = "ub_checks" , issue = "none" ) ]
28232794 const fn precondition_check( $( $name: $ty) ,* ) {
@@ -2885,13 +2856,7 @@ pub(crate) const fn is_nonoverlapping(
28852856 true
28862857 }
28872858
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)
28952860}
28962861
28972862/// 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
32083173
32093174 const fn compiletime ( _ptr : * const ( ) , _align : usize ) { }
32103175
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) ;
32163177}
0 commit comments