From: Mark Rousskov Date: Wed, 25 Jan 2023 14:48:32 +0000 (-0500) Subject: stage-step cfgs X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=5b08c9f39754039ef9c6cbde157ac9eb8c252a58;p=rust.git stage-step cfgs --- diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index a7d6fec7d3d..b75ae996e48 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -798,16 +798,7 @@ fn max(self, other: Self) -> Self Self: Sized, Self: ~const Destruct, { - #[cfg(not(bootstrap))] - { - max_by(self, other, Ord::cmp) - } - - #[cfg(bootstrap)] - match self.cmp(&other) { - Ordering::Less | Ordering::Equal => other, - Ordering::Greater => self, - } + max_by(self, other, Ord::cmp) } /// Compares and returns the minimum of two values. @@ -828,16 +819,7 @@ fn min(self, other: Self) -> Self Self: Sized, Self: ~const Destruct, { - #[cfg(not(bootstrap))] - { - min_by(self, other, Ord::cmp) - } - - #[cfg(bootstrap)] - match self.cmp(&other) { - Ordering::Less | Ordering::Equal => self, - Ordering::Greater => other, - } + min_by(self, other, Ord::cmp) } /// Restrict a value to a certain interval. @@ -1234,23 +1216,7 @@ pub const fn min_by_key K, K: ~const Ord>(v1: T, v2: T F: ~const Destruct, K: ~const Destruct, { - cfg_if! { - if #[cfg(bootstrap)] { - const fn imp K, K: ~const Ord>( - f: &mut F, - (v1, v2): (&T, &T), - ) -> Ordering - where - T: ~const Destruct, - K: ~const Destruct, - { - f(v1).cmp(&f(v2)) - } - min_by(v1, v2, ConstFnMutClosure::new(&mut f, imp)) - } else { - min_by(v1, v2, const |v1, v2| f(v1).cmp(&f(v2))) - } - } + min_by(v1, v2, const |v1, v2| f(v1).cmp(&f(v2))) } /// Compares and returns the maximum of two values. diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs index a315a28fb0d..b1ed3b31e43 100644 --- a/library/core/src/intrinsics.rs +++ b/library/core/src/intrinsics.rs @@ -58,7 +58,6 @@ use crate::marker::Tuple; use crate::mem; -#[cfg(not(bootstrap))] pub mod mir; // These imports are used for simplifying intra-doc links @@ -963,7 +962,6 @@ pub unsafe fn drop_in_place(to_drop: *mut T) { /// This intrinsic does not have a stable counterpart. #[rustc_const_unstable(feature = "const_assert_type2", issue = "none")] #[rustc_safe_intrinsic] - #[cfg(not(bootstrap))] pub fn assert_mem_uninitialized_valid(); /// Gets a reference to a static `Location` indicating where it was called. diff --git a/library/core/src/intrinsics/mir.rs b/library/core/src/intrinsics/mir.rs index e3157b66902..c0fd71ebae8 100644 --- a/library/core/src/intrinsics/mir.rs +++ b/library/core/src/intrinsics/mir.rs @@ -60,8 +60,7 @@ //! //! # Examples //! -#![cfg_attr(bootstrap, doc = "```rust,compile_fail")] -#![cfg_attr(not(bootstrap), doc = "```rust")] +//! ```rust //! #![feature(core_intrinsics, custom_mir)] //! //! extern crate core; @@ -294,8 +293,7 @@ fn Discriminant(place: T) -> ::Discrim /// /// # Examples /// - #[cfg_attr(bootstrap, doc = "```rust,compile_fail")] - #[cfg_attr(not(bootstrap), doc = "```rust")] + /// ```rust /// #![feature(custom_mir, core_intrinsics)] /// /// extern crate core; diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 8790649abe6..80cd5379067 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -191,7 +191,7 @@ #![feature(cfg_sanitize)] #![feature(cfg_target_has_atomic)] #![feature(cfg_target_has_atomic_equal_alignment)] -#![cfg_attr(not(bootstrap), feature(const_closures))] +#![feature(const_closures)] #![feature(const_fn_floating_point_arithmetic)] #![feature(const_mut_refs)] #![feature(const_precise_live_drops)] @@ -248,7 +248,6 @@ #![feature(sse4a_target_feature)] #![feature(tbm_target_feature)] #![feature(wasm_target_feature)] -#![cfg_attr(bootstrap, feature(f16c_target_feature))] // allow using `core::` in intra-doc links #[allow(unused_extern_crates)] diff --git a/library/core/src/mem/mod.rs b/library/core/src/mem/mod.rs index 5e01ccc07d8..a67df7ed557 100644 --- a/library/core/src/mem/mod.rs +++ b/library/core/src/mem/mod.rs @@ -682,7 +682,6 @@ pub unsafe fn zeroed() -> T { pub unsafe fn uninitialized() -> T { // SAFETY: the caller must guarantee that an uninitialized value is valid for `T`. unsafe { - #[cfg(not(bootstrap))] // If the compiler hits this itself then it deserves the UB. intrinsics::assert_mem_uninitialized_valid::(); let mut val = MaybeUninit::::uninit(); diff --git a/library/core/src/panicking.rs b/library/core/src/panicking.rs index 48e90e6d794..805a1e51ae9 100644 --- a/library/core/src/panicking.rs +++ b/library/core/src/panicking.rs @@ -117,7 +117,7 @@ pub const fn panic(expr: &'static str) -> ! { /// Like `panic`, but without unwinding and track_caller to reduce the impact on codesize. #[cfg_attr(not(feature = "panic_immediate_abort"), inline(never), cold)] #[cfg_attr(feature = "panic_immediate_abort", inline)] -#[cfg_attr(not(bootstrap), lang = "panic_nounwind")] // needed by codegen for non-unwinding panics +#[lang = "panic_nounwind"] // needed by codegen for non-unwinding panics #[rustc_nounwind] pub fn panic_nounwind(expr: &'static str) -> ! { panic_nounwind_fmt(fmt::Arguments::new_v1(&[expr], &[])); @@ -165,8 +165,7 @@ fn panic_bounds_check(index: usize, len: usize) -> ! { /// any extra arguments (including those synthesized by track_caller). #[cfg_attr(not(feature = "panic_immediate_abort"), inline(never), cold)] #[cfg_attr(feature = "panic_immediate_abort", inline)] -#[cfg_attr(bootstrap, lang = "panic_no_unwind")] // needed by codegen for panic in nounwind function -#[cfg_attr(not(bootstrap), lang = "panic_cannot_unwind")] // needed by codegen for panic in nounwind function +#[lang = "panic_cannot_unwind"] // needed by codegen for panic in nounwind function #[rustc_nounwind] fn panic_cannot_unwind() -> ! { panic_nounwind("panic in a function that cannot unwind") diff --git a/library/core/src/task/wake.rs b/library/core/src/task/wake.rs index 89adfccd901..808825326ae 100644 --- a/library/core/src/task/wake.rs +++ b/library/core/src/task/wake.rs @@ -174,7 +174,7 @@ pub const fn new( /// Currently, `Context` only serves to provide access to a [`&Waker`](Waker) /// which can be used to wake the current task. #[stable(feature = "futures_api", since = "1.36.0")] -#[cfg_attr(not(bootstrap), lang = "Context")] +#[lang = "Context"] pub struct Context<'a> { waker: &'a Waker, // Ensure we future-proof against variance changes by forcing