diff --git a/compiler/rustc_ast/src/lib.rs b/compiler/rustc_ast/src/lib.rs index ef60a1c9b5b..4f21ff41529 100644 --- a/compiler/rustc_ast/src/lib.rs +++ b/compiler/rustc_ast/src/lib.rs @@ -16,7 +16,6 @@ #![feature(box_patterns)] #![feature(if_let_guard)] #![feature(let_chains)] -#![cfg_attr(bootstrap, feature(min_specialization))] #![feature(never_type)] #![feature(negative_impls)] #![feature(stmt_expr_attributes)] diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 723f13dbe8d..238bc63ec58 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -7,7 +7,6 @@ #![allow(internal_features)] #![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::untranslatable_diagnostic)] -#![cfg_attr(bootstrap, feature(min_specialization))] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(array_windows)] diff --git a/compiler/rustc_hir/src/lib.rs b/compiler/rustc_hir/src/lib.rs index 9921686ce28..c5c4075c6ba 100644 --- a/compiler/rustc_hir/src/lib.rs +++ b/compiler/rustc_hir/src/lib.rs @@ -5,7 +5,6 @@ #![feature(associated_type_defaults)] #![feature(closure_track_caller)] #![feature(let_chains)] -#![cfg_attr(bootstrap, feature(min_specialization))] #![feature(never_type)] #![feature(rustc_attrs)] #![feature(variant_count)] diff --git a/compiler/rustc_hir_analysis/src/lib.rs b/compiler/rustc_hir_analysis/src/lib.rs index 19ab2045cc5..5fe8d1fe586 100644 --- a/compiler/rustc_hir_analysis/src/lib.rs +++ b/compiler/rustc_hir_analysis/src/lib.rs @@ -68,7 +68,6 @@ This API is completely unstable and subject to change. #![feature(is_sorted)] #![feature(iter_intersperse)] #![feature(let_chains)] -#![cfg_attr(bootstrap, feature(min_specialization))] #![feature(never_type)] #![feature(lazy_cell)] #![feature(slice_partition_dedup)] diff --git a/compiler/rustc_hir_typeck/src/lib.rs b/compiler/rustc_hir_typeck/src/lib.rs index bc6e09addce..d259e71f957 100644 --- a/compiler/rustc_hir_typeck/src/lib.rs +++ b/compiler/rustc_hir_typeck/src/lib.rs @@ -5,7 +5,6 @@ #![feature(try_blocks)] #![feature(never_type)] #![feature(box_patterns)] -#![cfg_attr(bootstrap, feature(min_specialization))] #![feature(control_flow_enum)] #[macro_use] diff --git a/compiler/rustc_infer/src/lib.rs b/compiler/rustc_infer/src/lib.rs index 3c2071be04e..f17c162bfe5 100644 --- a/compiler/rustc_infer/src/lib.rs +++ b/compiler/rustc_infer/src/lib.rs @@ -25,7 +25,6 @@ #![feature(let_chains)] #![feature(if_let_guard)] #![feature(iterator_try_collect)] -#![cfg_attr(bootstrap, feature(min_specialization))] #![feature(try_blocks)] #![recursion_limit = "512"] // For rustdoc diff --git a/compiler/rustc_middle/src/lib.rs b/compiler/rustc_middle/src/lib.rs index d910a15e262..e52a5863fd0 100644 --- a/compiler/rustc_middle/src/lib.rs +++ b/compiler/rustc_middle/src/lib.rs @@ -24,8 +24,7 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] -#![cfg_attr(bootstrap, feature(exhaustive_patterns))] -#![cfg_attr(not(bootstrap), feature(min_exhaustive_patterns))] +#![feature(min_exhaustive_patterns)] #![feature(rustdoc_internals)] #![feature(allocator_api)] #![feature(array_windows)] diff --git a/compiler/rustc_mir_build/src/lib.rs b/compiler/rustc_mir_build/src/lib.rs index b9a20cb21e9..7b22aea9158 100644 --- a/compiler/rustc_mir_build/src/lib.rs +++ b/compiler/rustc_mir_build/src/lib.rs @@ -9,7 +9,6 @@ #![feature(box_patterns)] #![feature(if_let_guard)] #![feature(let_chains)] -#![cfg_attr(bootstrap, feature(min_specialization))] #![feature(try_blocks)] #[macro_use] diff --git a/compiler/rustc_mir_dataflow/src/lib.rs b/compiler/rustc_mir_dataflow/src/lib.rs index f18a2354301..c5adb81b614 100644 --- a/compiler/rustc_mir_dataflow/src/lib.rs +++ b/compiler/rustc_mir_dataflow/src/lib.rs @@ -2,7 +2,6 @@ #![feature(box_patterns)] #![feature(exact_size_is_empty)] #![feature(let_chains)] -#![cfg_attr(bootstrap, feature(min_specialization))] #![feature(try_blocks)] #[macro_use] diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index c63bdff9a85..5d89015d61c 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -8,7 +8,6 @@ #![feature(is_sorted)] #![feature(let_chains)] #![feature(map_try_insert)] -#![cfg_attr(bootstrap, feature(min_specialization))] #![feature(never_type)] #![feature(option_get_or_insert_default)] #![feature(round_char_boundary)] diff --git a/compiler/rustc_target/src/lib.rs b/compiler/rustc_target/src/lib.rs index 8019d2b80cd..ba359ac6de1 100644 --- a/compiler/rustc_target/src/lib.rs +++ b/compiler/rustc_target/src/lib.rs @@ -9,13 +9,11 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] -#![cfg_attr(bootstrap, feature(exhaustive_patterns))] -#![cfg_attr(not(bootstrap), feature(min_exhaustive_patterns))] +#![feature(min_exhaustive_patterns)] #![feature(rustdoc_internals)] #![feature(assert_matches)] #![feature(iter_intersperse)] #![feature(let_chains)] -#![cfg_attr(bootstrap, feature(min_specialization))] #![feature(rustc_attrs)] #![feature(step_trait)] #![allow(internal_features)] diff --git a/compiler/rustc_trait_selection/src/lib.rs b/compiler/rustc_trait_selection/src/lib.rs index 9fac0ea7715..e14fc62cd6f 100644 --- a/compiler/rustc_trait_selection/src/lib.rs +++ b/compiler/rustc_trait_selection/src/lib.rs @@ -26,7 +26,6 @@ #![feature(option_take_if)] #![feature(never_type)] #![feature(type_alias_impl_trait)] -#![cfg_attr(bootstrap, feature(min_specialization))] #![recursion_limit = "512"] // For rustdoc #[macro_use] diff --git a/library/alloc/src/alloc.rs b/library/alloc/src/alloc.rs index a5d28aa5252..6677534eafc 100644 --- a/library/alloc/src/alloc.rs +++ b/library/alloc/src/alloc.rs @@ -51,7 +51,7 @@ extern "Rust" { #[derive(Copy, Clone, Default, Debug)] #[cfg(not(test))] // the compiler needs to know when a Box uses the global allocator vs a custom one -#[cfg_attr(not(bootstrap), lang = "global_alloc_ty")] +#[lang = "global_alloc_ty"] pub struct Global; #[cfg(test)] @@ -387,8 +387,7 @@ pub const fn handle_alloc_error(layout: Layout) -> ! { } #[cfg(not(feature = "panic_immediate_abort"))] - #[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block - unsafe { + { core::intrinsics::const_eval_select((layout,), ct_error, rt_error) } diff --git a/library/core/src/convert/mod.rs b/library/core/src/convert/mod.rs index 63fd23ea9a9..432e55e8c9a 100644 --- a/library/core/src/convert/mod.rs +++ b/library/core/src/convert/mod.rs @@ -396,7 +396,7 @@ pub trait AsMut { /// For example, take this code: /// /// ``` -/// # #![cfg_attr(not(bootstrap), allow(non_local_definitions))] +/// # #![allow(non_local_definitions)] /// struct Wrapper(Vec); /// impl From> for Vec { /// fn from(w: Wrapper) -> Vec { diff --git a/library/core/src/ffi/c_str.rs b/library/core/src/ffi/c_str.rs index 30debbffec1..dbdbaccb535 100644 --- a/library/core/src/ffi/c_str.rs +++ b/library/core/src/ffi/c_str.rs @@ -438,13 +438,7 @@ impl CStr { unsafe { &*(bytes as *const [u8] as *const CStr) } } - #[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block - // SAFETY: The const and runtime versions have identical behavior - // unless the safety contract of `from_bytes_with_nul_unchecked` is - // violated, which is UB. - unsafe { - intrinsics::const_eval_select((bytes,), const_impl, rt_impl) - } + intrinsics::const_eval_select((bytes,), const_impl, rt_impl) } /// Returns the inner pointer to this C string. @@ -759,11 +753,7 @@ const unsafe fn const_strlen(ptr: *const c_char) -> usize { unsafe { strlen(s) } } - #[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block - // SAFETY: the two functions always provide equivalent functionality - unsafe { - intrinsics::const_eval_select((ptr,), strlen_ct, strlen_rt) - } + intrinsics::const_eval_select((ptr,), strlen_ct, strlen_rt) } /// An iterator over the bytes of a [`CStr`], without the nul terminator. diff --git a/library/core/src/hash/mod.rs b/library/core/src/hash/mod.rs index bfdd28a7399..ef0793a3e46 100644 --- a/library/core/src/hash/mod.rs +++ b/library/core/src/hash/mod.rs @@ -454,7 +454,7 @@ pub trait Hasher { /// ``` /// #![feature(hasher_prefixfree_extras)] /// # // Stubs to make the `impl` below pass the compiler - /// # #![cfg_attr(not(bootstrap), allow(non_local_definitions))] + /// # #![allow(non_local_definitions)] /// # struct MyCollection(Option); /// # impl MyCollection { /// # fn len(&self) -> usize { todo!() } diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs index 66e55a5e217..613d0ab212a 100644 --- a/library/core/src/intrinsics.rs +++ b/library/core/src/intrinsics.rs @@ -84,9 +84,6 @@ pub unsafe fn drop_in_place(to_drop: *mut T) { unsafe { crate::ptr::drop_in_place(to_drop) } } -#[cfg(bootstrap)] -pub use self::r#try as catch_unwind; - extern "rust-intrinsic" { // N.B., these intrinsics take raw pointers because they mutate aliased // memory, which is not valid for either `&` or `&mut`. @@ -965,8 +962,7 @@ extern "rust-intrinsic" { #[rustc_const_stable(feature = "const_assume", since = "1.77.0")] #[rustc_nounwind] #[unstable(feature = "core_intrinsics", issue = "none")] -#[cfg_attr(not(bootstrap), rustc_intrinsic)] -#[cfg_attr(bootstrap, inline)] +#[rustc_intrinsic] pub const unsafe fn assume(b: bool) { if !b { // SAFETY: the caller must guarantee the argument is never `false` @@ -987,9 +983,8 @@ pub const unsafe fn assume(b: bool) { /// This intrinsic does not have a stable counterpart. #[rustc_const_unstable(feature = "const_likely", issue = "none")] #[unstable(feature = "core_intrinsics", issue = "none")] -#[cfg_attr(not(bootstrap), rustc_intrinsic)] +#[rustc_intrinsic] #[rustc_nounwind] -#[cfg_attr(bootstrap, inline)] pub const fn likely(b: bool) -> bool { b } @@ -1007,9 +1002,8 @@ pub const fn likely(b: bool) -> bool { /// This intrinsic does not have a stable counterpart. #[rustc_const_unstable(feature = "const_likely", issue = "none")] #[unstable(feature = "core_intrinsics", issue = "none")] -#[cfg_attr(not(bootstrap), rustc_intrinsic)] +#[rustc_intrinsic] #[rustc_nounwind] -#[cfg_attr(bootstrap, inline)] pub const fn unlikely(b: bool) -> bool { b } @@ -1919,7 +1913,6 @@ extern "rust-intrinsic" { /// This intrinsic does not have a stable counterpart. #[rustc_nounwind] #[rustc_safe_intrinsic] - #[cfg(not(bootstrap))] pub fn fadd_algebraic(a: T, b: T) -> T; /// Float subtraction that allows optimizations based on algebraic rules. @@ -1927,7 +1920,6 @@ extern "rust-intrinsic" { /// This intrinsic does not have a stable counterpart. #[rustc_nounwind] #[rustc_safe_intrinsic] - #[cfg(not(bootstrap))] pub fn fsub_algebraic(a: T, b: T) -> T; /// Float multiplication that allows optimizations based on algebraic rules. @@ -1935,7 +1927,6 @@ extern "rust-intrinsic" { /// This intrinsic does not have a stable counterpart. #[rustc_nounwind] #[rustc_safe_intrinsic] - #[cfg(not(bootstrap))] pub fn fmul_algebraic(a: T, b: T) -> T; /// Float division that allows optimizations based on algebraic rules. @@ -1943,7 +1934,6 @@ extern "rust-intrinsic" { /// This intrinsic does not have a stable counterpart. #[rustc_nounwind] #[rustc_safe_intrinsic] - #[cfg(not(bootstrap))] pub fn fdiv_algebraic(a: T, b: T) -> T; /// Float remainder that allows optimizations based on algebraic rules. @@ -1951,7 +1941,6 @@ extern "rust-intrinsic" { /// This intrinsic does not have a stable counterpart. #[rustc_nounwind] #[rustc_safe_intrinsic] - #[cfg(not(bootstrap))] pub fn frem_algebraic(a: T, b: T) -> T; /// Convert with LLVM’s fptoui/fptosi, which may return undef for values out of range @@ -2407,14 +2396,8 @@ extern "rust-intrinsic" { /// /// The stable version of this intrinsic is `std::panic::catch_unwind`. #[rustc_nounwind] - #[cfg(not(bootstrap))] pub fn catch_unwind(try_fn: fn(*mut u8), data: *mut u8, catch_fn: fn(*mut u8, *mut u8)) -> i32; - /// For bootstrap only, see `catch_unwind`. - #[rustc_nounwind] - #[cfg(bootstrap)] - pub fn r#try(try_fn: fn(*mut u8), data: *mut u8, catch_fn: fn(*mut u8, *mut u8)) -> i32; - /// Emits a `!nontemporal` store according to LLVM (see their docs). /// Probably will never become stable. /// @@ -2518,9 +2501,9 @@ extern "rust-intrinsic" { #[cfg(bootstrap)] pub fn vtable_align(ptr: *const ()) -> usize; - #[cfg(bootstrap)] #[rustc_const_unstable(feature = "const_eval_select", issue = "none")] - #[cfg_attr(not(bootstrap), rustc_safe_intrinsic)] + #[rustc_safe_intrinsic] + #[cfg(bootstrap)] pub fn const_eval_select( arg: ARG, called_in_const: F, @@ -2650,8 +2633,7 @@ where #[rustc_const_unstable(feature = "is_val_statically_known", issue = "none")] #[rustc_nounwind] #[unstable(feature = "core_intrinsics", issue = "none")] -#[cfg_attr(not(bootstrap), rustc_intrinsic)] -#[cfg_attr(bootstrap, inline)] +#[rustc_intrinsic] pub const fn is_val_statically_known(_arg: T) -> bool { false } @@ -2670,7 +2652,7 @@ pub const fn is_val_statically_known(_arg: T) -> bool { #[rustc_const_unstable(feature = "ub_checks", issue = "none")] #[unstable(feature = "core_intrinsics", issue = "none")] #[inline(always)] -#[cfg_attr(not(bootstrap), rustc_intrinsic)] +#[rustc_intrinsic] pub(crate) const fn check_library_ub() -> bool { cfg!(debug_assertions) } @@ -2686,7 +2668,7 @@ pub(crate) const fn check_library_ub() -> bool { #[rustc_const_unstable(feature = "ub_checks", issue = "none")] #[unstable(feature = "core_intrinsics", issue = "none")] #[inline(always)] -#[cfg_attr(not(bootstrap), rustc_intrinsic)] +#[rustc_intrinsic] pub(crate) const fn check_language_ub() -> bool { cfg!(debug_assertions) } @@ -2702,8 +2684,7 @@ pub(crate) const fn check_language_ub() -> bool { #[rustc_const_unstable(feature = "const_heap", issue = "79597")] #[unstable(feature = "core_intrinsics", issue = "none")] #[rustc_nounwind] -#[cfg_attr(not(bootstrap), rustc_intrinsic)] -#[cfg_attr(bootstrap, inline)] +#[rustc_intrinsic] pub const unsafe fn const_allocate(_size: usize, _align: usize) -> *mut u8 { // const eval overrides this function, but runtime code should always just return null pointers. crate::ptr::null_mut() @@ -2722,8 +2703,7 @@ pub const unsafe fn const_allocate(_size: usize, _align: usize) -> *mut u8 { #[rustc_const_unstable(feature = "const_heap", issue = "79597")] #[unstable(feature = "core_intrinsics", issue = "none")] #[rustc_nounwind] -#[cfg_attr(not(bootstrap), rustc_intrinsic)] -#[cfg_attr(bootstrap, inline)] +#[rustc_intrinsic] pub const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {} /// `ptr` must point to a vtable. @@ -2799,15 +2779,6 @@ pub unsafe fn vtable_align(_ptr: *const ()) -> usize { macro_rules! assert_unsafe_precondition { ($kind:ident, $message:expr, ($($name:ident:$ty:ty = $arg:expr),*$(,)?) => $e:expr $(,)?) => { { - // #[cfg(bootstrap)] (this comment) - // When the standard library is compiled with debug assertions, we want the check to inline for better performance. - // This is important when working on the compiler, which is compiled with debug assertions locally. - // When not compiled with debug assertions (so the precompiled std) we outline the check to minimize the compile - // time impact when debug assertions are disabled. - // The proper solution to this is the `#[rustc_no_mir_inline]` below, but we still want decent performance for cfg(bootstrap). - #[cfg_attr(all(debug_assertions, bootstrap), inline(always))] - #[cfg_attr(all(not(debug_assertions), bootstrap), inline(never))] - // This check is inlineable, but not by the MIR inliner. // The reason for this is that the MIR inliner is in an exceptionally bad position // 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 { // // LLVM on the other hand sees the constant branch, so if it's `false`, it can immediately delete it without // inlining the check. If it's `true`, it can inline it and get significantly better performance. - #[cfg_attr(not(bootstrap), rustc_no_mir_inline)] - #[cfg_attr(not(bootstrap), inline)] + #[rustc_no_mir_inline] + #[inline] #[rustc_nounwind] #[rustc_const_unstable(feature = "ub_checks", issue = "none")] const fn precondition_check($($name:$ty),*) { @@ -2885,13 +2856,7 @@ pub(crate) const fn is_nonoverlapping( true } - #[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block - // SAFETY: This function's precondition is equivalent to that of `const_eval_select`. - // Programs which do not execute UB will only see this function return `true`, which makes the - // const and runtime implementation indistinguishable. - unsafe { - const_eval_select((src, dst, size, count), comptime, runtime) - } + const_eval_select((src, dst, size, count), comptime, runtime) } /// Copies `count * size_of::()` bytes from `src` to `dst`. The source @@ -3208,9 +3173,5 @@ pub(crate) const fn miri_promise_symbolic_alignment(ptr: *const (), align: usize const fn compiletime(_ptr: *const (), _align: usize) {} - #[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block - // SAFETY: the extra behavior at runtime is for UB checks only. - unsafe { - const_eval_select((ptr, align), compiletime, runtime); - } + const_eval_select((ptr, align), compiletime, runtime); } diff --git a/library/core/src/intrinsics/simd.rs b/library/core/src/intrinsics/simd.rs index 2eaca3b6fe4..b69f4f853b9 100644 --- a/library/core/src/intrinsics/simd.rs +++ b/library/core/src/intrinsics/simd.rs @@ -2,11 +2,7 @@ //! //! In this module, a "vector" is any `repr(simd)` type. -// Temporary macro while we switch the ABI from "platform-intrinsics" to "intrinsics". -#[rustfmt::skip] -macro_rules! declare_intrinsics { -($abi:tt) => { -extern $abi { +extern "rust-intrinsic" { /// Insert an element into a vector, returning the updated vector. /// /// `T` must be a vector with element type `U`. @@ -659,10 +655,3 @@ extern $abi { #[rustc_nounwind] pub fn simd_flog(a: T) -> T; } -} -} - -#[cfg(bootstrap)] -declare_intrinsics!("platform-intrinsic"); -#[cfg(not(bootstrap))] -declare_intrinsics!("rust-intrinsic"); diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index f317584371e..2718dd11473 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -112,6 +112,7 @@ // // Library features: // tidy-alphabetical-start +#![cfg_attr(bootstrap, feature(associated_type_bounds))] #![feature(array_ptr_get)] #![feature(char_indices_offset)] #![feature(const_align_of_val)] @@ -203,12 +204,6 @@ // // Language features: // tidy-alphabetical-start -#![cfg_attr(bootstrap, feature(associated_type_bounds))] -#![cfg_attr(bootstrap, feature(diagnostic_namespace))] -#![cfg_attr(bootstrap, feature(exhaustive_patterns))] -#![cfg_attr(bootstrap, feature(platform_intrinsics))] -#![cfg_attr(not(bootstrap), feature(freeze_impls))] -#![cfg_attr(not(bootstrap), feature(min_exhaustive_patterns))] #![feature(abi_unadjusted)] #![feature(adt_const_params)] #![feature(allow_internal_unsafe)] @@ -233,6 +228,7 @@ #![feature(doc_notable_trait)] #![feature(effects)] #![feature(extern_types)] +#![feature(freeze_impls)] #![feature(fundamental)] #![feature(generic_arg_infer)] #![feature(if_let_guard)] @@ -243,6 +239,7 @@ #![feature(let_chains)] #![feature(link_llvm_intrinsics)] #![feature(macro_metavar_expr)] +#![feature(min_exhaustive_patterns)] #![feature(min_specialization)] #![feature(multiple_supertrait_upcastable)] #![feature(must_not_suspend)] diff --git a/library/core/src/mem/transmutability.rs b/library/core/src/mem/transmutability.rs index 0687874a258..827426b2358 100644 --- a/library/core/src/mem/transmutability.rs +++ b/library/core/src/mem/transmutability.rs @@ -6,7 +6,7 @@ use crate::marker::ConstParamTy; /// any value of type `Self` are safely transmutable into a value of type `Dst`, in a given `Context`, /// notwithstanding whatever safety checks you have asked the compiler to [`Assume`] are satisfied. #[unstable(feature = "transmutability", issue = "99571")] -#[cfg_attr(not(bootstrap), lang = "transmute_trait")] +#[lang = "transmute_trait"] #[rustc_deny_explicit_impl(implement_via_object = false)] #[rustc_coinductive] pub unsafe trait BikeshedIntrinsicFrom diff --git a/library/core/src/num/f32.rs b/library/core/src/num/f32.rs index abdcb7099ca..2e715fb0bdd 100644 --- a/library/core/src/num/f32.rs +++ b/library/core/src/num/f32.rs @@ -1153,11 +1153,7 @@ impl f32 { // Stability concerns. unsafe { mem::transmute(x) } } - #[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block - // SAFETY: We use internal implementations that either always work or fail at compile time. - unsafe { - intrinsics::const_eval_select((self,), ct_f32_to_u32, rt_f32_to_u32) - } + intrinsics::const_eval_select((self,), ct_f32_to_u32, rt_f32_to_u32) } /// Raw transmutation from `u32`. @@ -1248,11 +1244,7 @@ impl f32 { // Stability concerns. unsafe { mem::transmute(x) } } - #[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block - // SAFETY: We use internal implementations that either always work or fail at compile time. - unsafe { - intrinsics::const_eval_select((v,), ct_u32_to_f32, rt_u32_to_f32) - } + intrinsics::const_eval_select((v,), ct_u32_to_f32, rt_u32_to_f32) } /// Return the memory representation of this floating point number as a byte array in diff --git a/library/core/src/num/f64.rs b/library/core/src/num/f64.rs index f4d2a4f2167..d56f346d95e 100644 --- a/library/core/src/num/f64.rs +++ b/library/core/src/num/f64.rs @@ -1146,11 +1146,7 @@ impl f64 { // Stability concerns. unsafe { mem::transmute::(rt) } } - #[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block - // SAFETY: We use internal implementations that either always work or fail at compile time. - unsafe { - intrinsics::const_eval_select((self,), ct_f64_to_u64, rt_f64_to_u64) - } + intrinsics::const_eval_select((self,), ct_f64_to_u64, rt_f64_to_u64) } /// Raw transmutation from `u64`. @@ -1246,11 +1242,7 @@ impl f64 { // Stability concerns. unsafe { mem::transmute::(rt) } } - #[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block - // SAFETY: We use internal implementations that either always work or fail at compile time. - unsafe { - intrinsics::const_eval_select((v,), ct_u64_to_f64, rt_u64_to_f64) - } + intrinsics::const_eval_select((v,), ct_u64_to_f64, rt_u64_to_f64) } /// Return the memory representation of this floating point number as a byte array in diff --git a/library/core/src/ops/async_function.rs b/library/core/src/ops/async_function.rs index d6b06ffb7fc..c3a597e48af 100644 --- a/library/core/src/ops/async_function.rs +++ b/library/core/src/ops/async_function.rs @@ -140,7 +140,7 @@ mod internal_implementation_detail { /// and thus either `?0` or `i8`/`i16`/`i32` (see docs for `ClosureKind` /// for an explanation of that). The `GoalKind` is also the same type, but /// representing the kind of the trait that the closure is being called with. - #[cfg_attr(not(bootstrap), lang = "async_fn_kind_helper")] + #[lang = "async_fn_kind_helper"] trait AsyncFnKindHelper { // Projects a set of closure inputs (arguments), a region, and a set of upvars // (by move and by ref) to the upvars that we expect the coroutine to have diff --git a/library/core/src/panicking.rs b/library/core/src/panicking.rs index 9e1184c8f5b..9e8dac88816 100644 --- a/library/core/src/panicking.rs +++ b/library/core/src/panicking.rs @@ -117,11 +117,7 @@ pub const fn panic_nounwind_fmt(fmt: fmt::Arguments<'_>, force_no_backtrace: boo panic_fmt(fmt); } - #[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block - // SAFETY: const panic does not care about unwinding - unsafe { - super::intrinsics::const_eval_select((fmt, force_no_backtrace), comptime, runtime); - } + super::intrinsics::const_eval_select((fmt, force_no_backtrace), comptime, runtime); } // Next we define a bunch of higher-level wrappers that all bottom out in the two core functions diff --git a/library/core/src/ptr/const_ptr.rs b/library/core/src/ptr/const_ptr.rs index 979fd1e4b4a..69c61602073 100644 --- a/library/core/src/ptr/const_ptr.rs +++ b/library/core/src/ptr/const_ptr.rs @@ -48,12 +48,8 @@ impl *const T { } } - // on bootstrap bump, remove unsafe block - #[cfg_attr(not(bootstrap), allow(unused_unsafe))] - // SAFETY: The two versions are equivalent at runtime. - unsafe { - const_eval_select((self as *const u8,), const_impl, runtime_impl) - } + #[allow(unused_unsafe)] + const_eval_select((self as *const u8,), const_impl, runtime_impl) } /// Casts to a pointer of another type. @@ -818,13 +814,8 @@ impl *const T { true } - #[cfg_attr(not(bootstrap), allow(unused_unsafe))] - // on bootstrap bump, remove unsafe block - // SAFETY: This function is only used to provide the same check that the const eval - // interpreter does at runtime. - unsafe { - intrinsics::const_eval_select((this, origin), comptime, runtime) - } + #[allow(unused_unsafe)] + intrinsics::const_eval_select((this, origin), comptime, runtime) } assert_unsafe_precondition!( @@ -1648,11 +1639,7 @@ impl *const T { // The cast to `()` is used to // 1. deal with fat pointers; and // 2. ensure that `align_offset` (in `const_impl`) doesn't actually try to compute an offset. - #[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block - // SAFETY: The two versions are equivalent at runtime. - unsafe { - const_eval_select((self.cast::<()>(), align), const_impl, runtime_impl) - } + const_eval_select((self.cast::<()>(), align), const_impl, runtime_impl) } } diff --git a/library/core/src/ptr/mut_ptr.rs b/library/core/src/ptr/mut_ptr.rs index bfdd9dba320..1add9ca2311 100644 --- a/library/core/src/ptr/mut_ptr.rs +++ b/library/core/src/ptr/mut_ptr.rs @@ -48,11 +48,7 @@ impl *mut T { } } - #[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block - // SAFETY: The two versions are equivalent at runtime. - unsafe { - const_eval_select((self as *mut u8,), const_impl, runtime_impl) - } + const_eval_select((self as *mut u8,), const_impl, runtime_impl) } /// Casts to a pointer of another type. @@ -1906,11 +1902,7 @@ impl *mut T { // The cast to `()` is used to // 1. deal with fat pointers; and // 2. ensure that `align_offset` (in `const_impl`) doesn't actually try to compute an offset. - #[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block - // SAFETY: The two versions are equivalent at runtime. - unsafe { - const_eval_select((self.cast::<()>(), align), const_impl, runtime_impl) - } + const_eval_select((self.cast::<()>(), align), const_impl, runtime_impl) } } diff --git a/library/core/src/slice/index.rs b/library/core/src/slice/index.rs index 64f1f360821..210118817ab 100644 --- a/library/core/src/slice/index.rs +++ b/library/core/src/slice/index.rs @@ -35,15 +35,7 @@ where #[track_caller] #[rustc_const_unstable(feature = "const_slice_index", issue = "none")] const fn slice_start_index_len_fail(index: usize, len: usize) -> ! { - #[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block - // SAFETY: we are just panicking here - unsafe { - const_eval_select( - (index, len), - slice_start_index_len_fail_ct, - slice_start_index_len_fail_rt, - ) - } + const_eval_select((index, len), slice_start_index_len_fail_ct, slice_start_index_len_fail_rt) } // FIXME const-hack @@ -64,11 +56,7 @@ const fn slice_start_index_len_fail_ct(_: usize, _: usize) -> ! { #[track_caller] #[rustc_const_unstable(feature = "const_slice_index", issue = "none")] const fn slice_end_index_len_fail(index: usize, len: usize) -> ! { - #[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block - // SAFETY: we are just panicking here - unsafe { - const_eval_select((index, len), slice_end_index_len_fail_ct, slice_end_index_len_fail_rt) - } + const_eval_select((index, len), slice_end_index_len_fail_ct, slice_end_index_len_fail_rt) } // FIXME const-hack @@ -89,11 +77,7 @@ const fn slice_end_index_len_fail_ct(_: usize, _: usize) -> ! { #[track_caller] #[rustc_const_unstable(feature = "const_slice_index", issue = "none")] const fn slice_index_order_fail(index: usize, end: usize) -> ! { - #[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block - // SAFETY: we are just panicking here - unsafe { - const_eval_select((index, end), slice_index_order_fail_ct, slice_index_order_fail_rt) - } + const_eval_select((index, end), slice_index_order_fail_ct, slice_index_order_fail_rt) } // FIXME const-hack diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index 4943bbc45d0..61a60456145 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -86,15 +86,7 @@ use iter::{MatchesInternal, SplitNInternal}; #[rustc_allow_const_fn_unstable(const_eval_select)] #[cfg(not(feature = "panic_immediate_abort"))] const fn slice_error_fail(s: &str, begin: usize, end: usize) -> ! { - #[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block - // SAFETY: panics for both branches - unsafe { - crate::intrinsics::const_eval_select( - (s, begin, end), - slice_error_fail_ct, - slice_error_fail_rt, - ) - } + crate::intrinsics::const_eval_select((s, begin, end), slice_error_fail_ct, slice_error_fail_rt) } #[cfg(feature = "panic_immediate_abort")] diff --git a/library/core/tests/iter/adapters/step_by.rs b/library/core/tests/iter/adapters/step_by.rs index 29adf0b42fa..6f3300e7a88 100644 --- a/library/core/tests/iter/adapters/step_by.rs +++ b/library/core/tests/iter/adapters/step_by.rs @@ -49,7 +49,7 @@ fn test_iterator_step_by_nth() { } #[test] -#[cfg_attr(not(bootstrap), allow(non_local_definitions))] +#[allow(non_local_definitions)] fn test_iterator_step_by_nth_overflow() { #[cfg(target_pointer_width = "16")] type Bigger = u32; diff --git a/library/core/tests/result.rs b/library/core/tests/result.rs index d02dc45da34..a47ef7aa1eb 100644 --- a/library/core/tests/result.rs +++ b/library/core/tests/result.rs @@ -195,7 +195,7 @@ pub fn test_unwrap_or_default() { } #[test] -#[cfg_attr(not(bootstrap), allow(non_local_definitions))] +#[allow(non_local_definitions)] pub fn test_into_ok() { fn infallible_op() -> Result { Ok(666) @@ -218,7 +218,7 @@ pub fn test_into_ok() { } #[test] -#[cfg_attr(not(bootstrap), allow(non_local_definitions))] +#[allow(non_local_definitions)] pub fn test_into_err() { fn until_error_op() -> Result { Err(666) diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 3db5cda83b7..c457c39e0c1 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -270,9 +270,6 @@ // // Language features: // tidy-alphabetical-start -#![cfg_attr(bootstrap, feature(exhaustive_patterns))] -#![cfg_attr(bootstrap, feature(platform_intrinsics))] -#![cfg_attr(not(bootstrap), feature(min_exhaustive_patterns))] #![feature(alloc_error_handler)] #![feature(allocator_internals)] #![feature(allow_internal_unsafe)] @@ -297,6 +294,7 @@ #![feature(let_chains)] #![feature(link_cfg)] #![feature(linkage)] +#![feature(min_exhaustive_patterns)] #![feature(min_specialization)] #![feature(must_not_suspend)] #![feature(needs_panic_runtime)] diff --git a/library/std/src/sys/thread_local/static_local.rs b/library/std/src/sys/thread_local/static_local.rs index 4f2b6868962..206e62bb5e2 100644 --- a/library/std/src/sys/thread_local/static_local.rs +++ b/library/std/src/sys/thread_local/static_local.rs @@ -12,8 +12,7 @@ pub macro thread_local_inner { #[inline] // see comments below #[deny(unsafe_op_in_unsafe_fn)] // FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint - #[cfg_attr(bootstrap, allow(static_mut_ref))] - #[cfg_attr(not(bootstrap), allow(static_mut_refs))] + #[allow(static_mut_refs)] unsafe fn __getit( _init: $crate::option::Option<&mut $crate::option::Option<$t>>, ) -> $crate::option::Option<&'static $t> { diff --git a/library/unwind/src/lib.rs b/library/unwind/src/lib.rs index 45aa0ea4fbb..25bb5938b4c 100644 --- a/library/unwind/src/lib.rs +++ b/library/unwind/src/lib.rs @@ -3,7 +3,6 @@ #![feature(link_cfg)] #![feature(staged_api)] #![feature(c_unwind)] -#![cfg_attr(bootstrap, feature(cfg_target_abi))] #![feature(strict_provenance)] #![cfg_attr(not(target_env = "msvc"), feature(libc))] #![cfg_attr( diff --git a/src/tools/compiletest/src/header/tests.rs b/src/tools/compiletest/src/header/tests.rs index cf300fbe74f..83f0755b5c8 100644 --- a/src/tools/compiletest/src/header/tests.rs +++ b/src/tools/compiletest/src/header/tests.rs @@ -537,15 +537,9 @@ fn wasm_special() { ("wasm32-wasi", "wasm32", true), ("wasm32-wasi", "wasm32-bare", false), ("wasm32-wasi", "wasi", true), - // NB: the wasm32-wasip1 target is new so this isn't tested for - // the bootstrap compiler. - #[cfg(not(bootstrap))] ("wasm32-wasip1", "emscripten", false), - #[cfg(not(bootstrap))] ("wasm32-wasip1", "wasm32", true), - #[cfg(not(bootstrap))] ("wasm32-wasip1", "wasm32-bare", false), - #[cfg(not(bootstrap))] ("wasm32-wasip1", "wasi", true), ("wasm64-unknown-unknown", "emscripten", false), ("wasm64-unknown-unknown", "wasm32", false), @@ -604,11 +598,8 @@ fn threads_support() { ("aarch64-apple-darwin", true), ("wasm32-unknown-unknown", false), ("wasm64-unknown-unknown", false), - #[cfg(not(bootstrap))] ("wasm32-wasip1", false), - #[cfg(not(bootstrap))] ("wasm32-wasip1-threads", true), - ("wasm32-wasi-preview1-threads", true), ]; for (target, has_threads) in threads { let config = cfg().target(target).build(); diff --git a/src/tools/rustfmt/src/source_file.rs b/src/tools/rustfmt/src/source_file.rs index 6376bc49b69..2b43ec94b6b 100644 --- a/src/tools/rustfmt/src/source_file.rs +++ b/src/tools/rustfmt/src/source_file.rs @@ -66,7 +66,7 @@ where } } - #[cfg_attr(not(bootstrap), allow(non_local_definitions))] + #[allow(non_local_definitions)] impl From<&FileName> for rustc_span::FileName { fn from(filename: &FileName) -> rustc_span::FileName { match filename {