stage-step cfgs

This commit is contained in:
Mark Rousskov 2023-01-25 09:48:32 -05:00
parent 17887f7a72
commit 5b08c9f397
7 changed files with 9 additions and 50 deletions

View File

@ -798,16 +798,7 @@ pub trait Ord: Eq + PartialOrd<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 @@ pub trait Ord: Eq + PartialOrd<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 @@ where
F: ~const Destruct,
K: ~const Destruct,
{
cfg_if! {
if #[cfg(bootstrap)] {
const fn imp<T, F: ~const FnMut(&T) -> 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.

View File

@ -58,7 +58,6 @@ use crate::marker::DiscriminantKind;
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 @@ extern "rust-intrinsic" {
/// 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<T>();
/// Gets a reference to a static `Location` indicating where it was called.

View File

@ -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 @@ define!(
///
/// # Examples
///
#[cfg_attr(bootstrap, doc = "```rust,compile_fail")]
#[cfg_attr(not(bootstrap), doc = "```rust")]
/// ```rust
/// #![feature(custom_mir, core_intrinsics)]
///
/// extern crate core;

View File

@ -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)]

View File

@ -682,7 +682,6 @@ pub unsafe fn zeroed<T>() -> T {
pub unsafe fn uninitialized<T>() -> 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::<T>();
let mut val = MaybeUninit::<T>::uninit();

View File

@ -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")

View File

@ -174,7 +174,7 @@ impl RawWakerVTable {
/// 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