1
Fork 0

Step bootstrap cfgs

This commit is contained in:
Mark Rousskov 2024-04-29 09:27:34 -04:00
parent 377c518bce
commit a64f941611
44 changed files with 38 additions and 282 deletions

View file

@ -11,7 +11,6 @@
#![doc(rust_logo)] #![doc(rust_logo)]
#![allow(internal_features)] #![allow(internal_features)]
#![feature(rustdoc_internals)] #![feature(rustdoc_internals)]
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![feature(associated_type_defaults)] #![feature(associated_type_defaults)]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(if_let_guard)] #![feature(if_let_guard)]

View file

@ -4,7 +4,6 @@
#![feature(rustdoc_internals)] #![feature(rustdoc_internals)]
#![doc(rust_logo)] #![doc(rust_logo)]
#![feature(assert_matches)] #![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(control_flow_enum)] #![feature(control_flow_enum)]
#![feature(let_chains)] #![feature(let_chains)]

View file

@ -420,7 +420,6 @@ pub fn panic(_msg: &'static str) -> ! {
macro_rules! panic_const { macro_rules! panic_const {
($($lang:ident = $message:expr,)+) => { ($($lang:ident = $message:expr,)+) => {
#[cfg(not(bootstrap))]
pub mod panic_const { pub mod panic_const {
use super::*; use super::*;

View file

@ -23,7 +23,6 @@
trusted_len, trusted_len,
hash_raw_entry hash_raw_entry
)] )]
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![allow(broken_intra_doc_links)] #![allow(broken_intra_doc_links)]
#![recursion_limit = "256"] #![recursion_limit = "256"]
#![warn(rust_2018_idioms)] #![warn(rust_2018_idioms)]

View file

@ -4,7 +4,6 @@
#![allow(internal_features)] #![allow(internal_features)]
#![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)] #![allow(rustc::untranslatable_diagnostic)]
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(if_let_guard)] #![feature(if_let_guard)]
#![feature(let_chains)] #![feature(let_chains)]

View file

@ -1,7 +1,6 @@
#![doc(rust_logo)] #![doc(rust_logo)]
#![feature(rustdoc_internals)] #![feature(rustdoc_internals)]
#![feature(array_windows)] #![feature(array_windows)]
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![feature(associated_type_defaults)] #![feature(associated_type_defaults)]
#![feature(if_let_guard)] #![feature(if_let_guard)]
#![feature(let_chains)] #![feature(let_chains)]

View file

@ -18,7 +18,6 @@
#![allow(internal_features)] #![allow(internal_features)]
#![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)] #![allow(rustc::untranslatable_diagnostic)]
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(control_flow_enum)] #![feature(control_flow_enum)]
#![feature(extend_one)] #![feature(extend_one)]

View file

@ -1261,7 +1261,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
sess: &'a Session, sess: &'a Session,
) -> impl Iterator<Item = ModChild> + 'a { ) -> impl Iterator<Item = ModChild> + 'a {
iter::from_coroutine( iter::from_coroutine(
#[cfg_attr(not(bootstrap), coroutine)] #[coroutine]
move || { move || {
if let Some(data) = &self.root.proc_macro_data { if let Some(data) = &self.root.proc_macro_data {
// If we are loading as a proc macro, we want to return // If we are loading as a proc macro, we want to return

View file

@ -37,7 +37,6 @@
#![feature(coroutines)] #![feature(coroutines)]
#![feature(stmt_expr_attributes)] #![feature(stmt_expr_attributes)]
#![feature(if_let_guard)] #![feature(if_let_guard)]
#![cfg_attr(bootstrap, feature(inline_const))]
#![feature(iter_from_coroutine)] #![feature(iter_from_coroutine)]
#![feature(negative_impls)] #![feature(negative_impls)]
#![feature(never_type)] #![feature(never_type)]
@ -48,7 +47,6 @@
#![feature(trusted_len)] #![feature(trusted_len)]
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
#![feature(strict_provenance)] #![feature(strict_provenance)]
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![feature(control_flow_enum)] #![feature(control_flow_enum)]
#![feature(trait_upcasting)] #![feature(trait_upcasting)]

View file

@ -424,7 +424,7 @@ pub fn analyze_coroutine_closure_captures<'a, 'tcx: 'a, T>(
mut for_each: impl FnMut((usize, &'a CapturedPlace<'tcx>), (usize, &'a CapturedPlace<'tcx>)) -> T, mut for_each: impl FnMut((usize, &'a CapturedPlace<'tcx>), (usize, &'a CapturedPlace<'tcx>)) -> T,
) -> impl Iterator<Item = T> + Captures<'a> + Captures<'tcx> { ) -> impl Iterator<Item = T> + Captures<'a> + Captures<'tcx> {
std::iter::from_coroutine( std::iter::from_coroutine(
#[cfg_attr(not(bootstrap), coroutine)] #[coroutine]
move || { move || {
let mut child_captures = child_captures.into_iter().enumerate().peekable(); let mut child_captures = child_captures.into_iter().enumerate().peekable();

View file

@ -1285,7 +1285,7 @@ impl<'tcx> TyCtxt<'tcx> {
let definitions = &self.untracked.definitions; let definitions = &self.untracked.definitions;
std::iter::from_coroutine( std::iter::from_coroutine(
#[cfg_attr(not(bootstrap), coroutine)] #[coroutine]
|| { || {
let mut i = 0; let mut i = 0;

View file

@ -5,7 +5,6 @@
#![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)] #![allow(rustc::untranslatable_diagnostic)]
#![feature(assert_matches)] #![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(if_let_guard)] #![feature(if_let_guard)]
#![feature(let_chains)] #![feature(let_chains)]

View file

@ -4,7 +4,6 @@
#![feature(cow_is_borrowed)] #![feature(cow_is_borrowed)]
#![feature(decl_macro)] #![feature(decl_macro)]
#![feature(impl_trait_in_assoc_type)] #![feature(impl_trait_in_assoc_type)]
#![cfg_attr(bootstrap, feature(inline_const))]
#![feature(is_sorted)] #![feature(is_sorted)]
#![feature(let_chains)] #![feature(let_chains)]
#![feature(map_try_insert)] #![feature(map_try_insert)]

View file

@ -8,10 +8,8 @@
#![doc(rust_logo)] #![doc(rust_logo)]
#![allow(internal_features)] #![allow(internal_features)]
#![feature(rustdoc_internals)] #![feature(rustdoc_internals)]
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![feature(const_option)] #![feature(const_option)]
#![feature(core_intrinsics)] #![feature(core_intrinsics)]
#![cfg_attr(bootstrap, feature(inline_const))]
#![feature(min_specialization)] #![feature(min_specialization)]
#![feature(never_type)] #![feature(never_type)]
#![feature(ptr_sub_ptr)] #![feature(ptr_sub_ptr)]

View file

@ -17,7 +17,6 @@
#![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)] #![allow(rustc::untranslatable_diagnostic)]
#![feature(assert_matches)] #![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![feature(associated_type_defaults)] #![feature(associated_type_defaults)]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(control_flow_enum)] #![feature(control_flow_enum)]

View file

@ -165,9 +165,6 @@
// //
// Language features: // Language features:
// tidy-alphabetical-start // tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![cfg_attr(bootstrap, feature(inline_const))]
#![cfg_attr(not(bootstrap), rustc_preserve_ub_checks)]
#![cfg_attr(not(test), feature(coroutine_trait))] #![cfg_attr(not(test), feature(coroutine_trait))]
#![cfg_attr(test, feature(panic_update_hook))] #![cfg_attr(test, feature(panic_update_hook))]
#![cfg_attr(test, feature(test))] #![cfg_attr(test, feature(test))]
@ -198,6 +195,7 @@
#![feature(unboxed_closures)] #![feature(unboxed_closures)]
#![feature(unsized_fn_params)] #![feature(unsized_fn_params)]
#![feature(with_negative_coherence)] #![feature(with_negative_coherence)]
#![rustc_preserve_ub_checks]
// tidy-alphabetical-end // tidy-alphabetical-end
// //
// Rustdoc features: // Rustdoc features:

View file

@ -1,4 +1,3 @@
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![feature(allocator_api)] #![feature(allocator_api)]
#![feature(alloc_layout_extra)] #![feature(alloc_layout_extra)]
#![feature(iter_array_chunks)] #![feature(iter_array_chunks)]

View file

@ -379,7 +379,7 @@ pub struct AssertParamIsEq<T: Eq + ?Sized> {
// This is a lang item only so that `BinOp::Cmp` in MIR can return it. // This is a lang item only so that `BinOp::Cmp` in MIR can return it.
// It has no special behaviour, but does require that the three variants // It has no special behaviour, but does require that the three variants
// `Less`/`Equal`/`Greater` remain `-1_i8`/`0_i8`/`+1_i8` respectively. // `Less`/`Equal`/`Greater` remain `-1_i8`/`0_i8`/`+1_i8` respectively.
#[cfg_attr(not(bootstrap), lang = "Ordering")] #[lang = "Ordering"]
#[repr(i8)] #[repr(i8)]
pub enum Ordering { pub enum Ordering {
/// An ordering where a compared value is less than another. /// An ordering where a compared value is less than another.
@ -852,7 +852,7 @@ pub trait Ord: Eq + PartialOrd<Self> {
#[stable(feature = "ord_max_min", since = "1.21.0")] #[stable(feature = "ord_max_min", since = "1.21.0")]
#[inline] #[inline]
#[must_use] #[must_use]
#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "cmp_ord_max")] #[rustc_diagnostic_item = "cmp_ord_max"]
fn max(self, other: Self) -> Self fn max(self, other: Self) -> Self
where where
Self: Sized, Self: Sized,
@ -873,7 +873,7 @@ pub trait Ord: Eq + PartialOrd<Self> {
#[stable(feature = "ord_max_min", since = "1.21.0")] #[stable(feature = "ord_max_min", since = "1.21.0")]
#[inline] #[inline]
#[must_use] #[must_use]
#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "cmp_ord_min")] #[rustc_diagnostic_item = "cmp_ord_min"]
fn min(self, other: Self) -> Self fn min(self, other: Self) -> Self
where where
Self: Sized, Self: Sized,
@ -1160,7 +1160,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
/// ``` /// ```
#[must_use] #[must_use]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "cmp_partialord_cmp")] #[rustc_diagnostic_item = "cmp_partialord_cmp"]
fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>; fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>;
/// This method tests less than (for `self` and `other`) and is used by the `<` operator. /// This method tests less than (for `self` and `other`) and is used by the `<` operator.
@ -1175,7 +1175,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
#[inline] #[inline]
#[must_use] #[must_use]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "cmp_partialord_lt")] #[rustc_diagnostic_item = "cmp_partialord_lt"]
fn lt(&self, other: &Rhs) -> bool { fn lt(&self, other: &Rhs) -> bool {
matches!(self.partial_cmp(other), Some(Less)) matches!(self.partial_cmp(other), Some(Less))
} }
@ -1193,7 +1193,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
#[inline] #[inline]
#[must_use] #[must_use]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "cmp_partialord_le")] #[rustc_diagnostic_item = "cmp_partialord_le"]
fn le(&self, other: &Rhs) -> bool { fn le(&self, other: &Rhs) -> bool {
matches!(self.partial_cmp(other), Some(Less | Equal)) matches!(self.partial_cmp(other), Some(Less | Equal))
} }
@ -1210,7 +1210,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
#[inline] #[inline]
#[must_use] #[must_use]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "cmp_partialord_gt")] #[rustc_diagnostic_item = "cmp_partialord_gt"]
fn gt(&self, other: &Rhs) -> bool { fn gt(&self, other: &Rhs) -> bool {
matches!(self.partial_cmp(other), Some(Greater)) matches!(self.partial_cmp(other), Some(Greater))
} }
@ -1228,7 +1228,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
#[inline] #[inline]
#[must_use] #[must_use]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "cmp_partialord_ge")] #[rustc_diagnostic_item = "cmp_partialord_ge"]
fn ge(&self, other: &Rhs) -> bool { fn ge(&self, other: &Rhs) -> bool {
matches!(self.partial_cmp(other), Some(Greater | Equal)) matches!(self.partial_cmp(other), Some(Greater | Equal))
} }
@ -1558,14 +1558,7 @@ mod impls {
impl PartialOrd for $t { impl PartialOrd for $t {
#[inline] #[inline]
fn partial_cmp(&self, other: &$t) -> Option<Ordering> { fn partial_cmp(&self, other: &$t) -> Option<Ordering> {
#[cfg(bootstrap)] Some(crate::intrinsics::three_way_compare(*self, *other))
{
Some(self.cmp(other))
}
#[cfg(not(bootstrap))]
{
Some(crate::intrinsics::three_way_compare(*self, *other))
}
} }
#[inline(always)] #[inline(always)]
fn lt(&self, other: &$t) -> bool { (*self) < (*other) } fn lt(&self, other: &$t) -> bool { (*self) < (*other) }
@ -1581,18 +1574,7 @@ mod impls {
impl Ord for $t { impl Ord for $t {
#[inline] #[inline]
fn cmp(&self, other: &$t) -> Ordering { fn cmp(&self, other: &$t) -> Ordering {
#[cfg(bootstrap)] crate::intrinsics::three_way_compare(*self, *other)
{
// The order here is important to generate more optimal assembly.
// See <https://github.com/rust-lang/rust/issues/63758> for more info.
if *self < *other { Less }
else if *self == *other { Equal }
else { Greater }
}
#[cfg(not(bootstrap))]
{
crate::intrinsics::three_way_compare(*self, *other)
}
} }
} }
)*) )*)

View file

@ -178,9 +178,7 @@ default_impl! { i32, 0, "Returns the default value of `0`" }
default_impl! { i64, 0, "Returns the default value of `0`" } default_impl! { i64, 0, "Returns the default value of `0`" }
default_impl! { i128, 0, "Returns the default value of `0`" } default_impl! { i128, 0, "Returns the default value of `0`" }
#[cfg(not(bootstrap))]
default_impl! { f16, 0.0f16, "Returns the default value of `0.0`" } default_impl! { f16, 0.0f16, "Returns the default value of `0.0`" }
default_impl! { f32, 0.0f32, "Returns the default value of `0.0`" } default_impl! { f32, 0.0f32, "Returns the default value of `0.0`" }
default_impl! { f64, 0.0f64, "Returns the default value of `0.0`" } default_impl! { f64, 0.0f64, "Returns the default value of `0.0`" }
#[cfg(not(bootstrap))]
default_impl! { f128, 0.0f128, "Returns the default value of `0.0`" } default_impl! { f128, 0.0f128, "Returns the default value of `0.0`" }

View file

@ -12,7 +12,6 @@
use crate::ptr::NonNull; use crate::ptr::NonNull;
use crate::task::Context; use crate::task::Context;
#[cfg(not(bootstrap))]
mod async_drop; mod async_drop;
mod future; mod future;
mod into_future; mod into_future;
@ -38,7 +37,6 @@ pub use ready::{ready, Ready};
#[stable(feature = "future_poll_fn", since = "1.64.0")] #[stable(feature = "future_poll_fn", since = "1.64.0")]
pub use poll_fn::{poll_fn, PollFn}; pub use poll_fn::{poll_fn, PollFn};
#[cfg(not(bootstrap))]
#[unstable(feature = "async_drop", issue = "none")] #[unstable(feature = "async_drop", issue = "none")]
pub use async_drop::{async_drop, async_drop_in_place, AsyncDrop, AsyncDropInPlace}; pub use async_drop::{async_drop, async_drop_in_place, AsyncDrop, AsyncDropInPlace};

View file

@ -1987,18 +1987,11 @@ extern "rust-intrinsic" {
/// The stabilized versions of this intrinsic are available on the integer /// The stabilized versions of this intrinsic are available on the integer
/// primitives via the `count_ones` method. For example, /// primitives via the `count_ones` method. For example,
/// [`u32::count_ones`] /// [`u32::count_ones`]
#[cfg(not(bootstrap))]
#[rustc_const_stable(feature = "const_ctpop", since = "1.40.0")] #[rustc_const_stable(feature = "const_ctpop", since = "1.40.0")]
#[rustc_safe_intrinsic] #[rustc_safe_intrinsic]
#[rustc_nounwind] #[rustc_nounwind]
pub fn ctpop<T: Copy>(x: T) -> u32; pub fn ctpop<T: Copy>(x: T) -> u32;
#[cfg(bootstrap)]
#[rustc_const_stable(feature = "const_ctpop", since = "1.40.0")]
#[rustc_safe_intrinsic]
#[rustc_nounwind]
pub fn ctpop<T: Copy>(x: T) -> T;
/// Returns the number of leading unset bits (zeroes) in an integer type `T`. /// Returns the number of leading unset bits (zeroes) in an integer type `T`.
/// ///
/// Note that, unlike most intrinsics, this is safe to call; /// Note that, unlike most intrinsics, this is safe to call;
@ -2035,18 +2028,11 @@ extern "rust-intrinsic" {
/// let num_leading = ctlz(x); /// let num_leading = ctlz(x);
/// assert_eq!(num_leading, 16); /// assert_eq!(num_leading, 16);
/// ``` /// ```
#[cfg(not(bootstrap))]
#[rustc_const_stable(feature = "const_ctlz", since = "1.40.0")] #[rustc_const_stable(feature = "const_ctlz", since = "1.40.0")]
#[rustc_safe_intrinsic] #[rustc_safe_intrinsic]
#[rustc_nounwind] #[rustc_nounwind]
pub fn ctlz<T: Copy>(x: T) -> u32; pub fn ctlz<T: Copy>(x: T) -> u32;
#[cfg(bootstrap)]
#[rustc_const_stable(feature = "const_ctlz", since = "1.40.0")]
#[rustc_safe_intrinsic]
#[rustc_nounwind]
pub fn ctlz<T: Copy>(x: T) -> T;
/// Like `ctlz`, but extra-unsafe as it returns `undef` when /// Like `ctlz`, but extra-unsafe as it returns `undef` when
/// given an `x` with value `0`. /// given an `x` with value `0`.
/// ///
@ -2064,16 +2050,10 @@ extern "rust-intrinsic" {
/// let num_leading = unsafe { ctlz_nonzero(x) }; /// let num_leading = unsafe { ctlz_nonzero(x) };
/// assert_eq!(num_leading, 3); /// assert_eq!(num_leading, 3);
/// ``` /// ```
#[cfg(not(bootstrap))]
#[rustc_const_stable(feature = "constctlz", since = "1.50.0")] #[rustc_const_stable(feature = "constctlz", since = "1.50.0")]
#[rustc_nounwind] #[rustc_nounwind]
pub fn ctlz_nonzero<T: Copy>(x: T) -> u32; pub fn ctlz_nonzero<T: Copy>(x: T) -> u32;
#[cfg(bootstrap)]
#[rustc_const_stable(feature = "constctlz", since = "1.50.0")]
#[rustc_nounwind]
pub fn ctlz_nonzero<T: Copy>(x: T) -> T;
/// Returns the number of trailing unset bits (zeroes) in an integer type `T`. /// Returns the number of trailing unset bits (zeroes) in an integer type `T`.
/// ///
/// Note that, unlike most intrinsics, this is safe to call; /// Note that, unlike most intrinsics, this is safe to call;
@ -2110,18 +2090,11 @@ extern "rust-intrinsic" {
/// let num_trailing = cttz(x); /// let num_trailing = cttz(x);
/// assert_eq!(num_trailing, 16); /// assert_eq!(num_trailing, 16);
/// ``` /// ```
#[cfg(not(bootstrap))]
#[rustc_const_stable(feature = "const_cttz", since = "1.40.0")] #[rustc_const_stable(feature = "const_cttz", since = "1.40.0")]
#[rustc_safe_intrinsic] #[rustc_safe_intrinsic]
#[rustc_nounwind] #[rustc_nounwind]
pub fn cttz<T: Copy>(x: T) -> u32; pub fn cttz<T: Copy>(x: T) -> u32;
#[cfg(bootstrap)]
#[rustc_const_stable(feature = "const_cttz", since = "1.40.0")]
#[rustc_safe_intrinsic]
#[rustc_nounwind]
pub fn cttz<T: Copy>(x: T) -> T;
/// Like `cttz`, but extra-unsafe as it returns `undef` when /// Like `cttz`, but extra-unsafe as it returns `undef` when
/// given an `x` with value `0`. /// given an `x` with value `0`.
/// ///
@ -2139,16 +2112,10 @@ extern "rust-intrinsic" {
/// let num_trailing = unsafe { cttz_nonzero(x) }; /// let num_trailing = unsafe { cttz_nonzero(x) };
/// assert_eq!(num_trailing, 3); /// assert_eq!(num_trailing, 3);
/// ``` /// ```
#[cfg(not(bootstrap))]
#[rustc_const_stable(feature = "const_cttz_nonzero", since = "1.53.0")] #[rustc_const_stable(feature = "const_cttz_nonzero", since = "1.53.0")]
#[rustc_nounwind] #[rustc_nounwind]
pub fn cttz_nonzero<T: Copy>(x: T) -> u32; pub fn cttz_nonzero<T: Copy>(x: T) -> u32;
#[cfg(bootstrap)]
#[rustc_const_stable(feature = "const_cttz_nonzero", since = "1.53.0")]
#[rustc_nounwind]
pub fn cttz_nonzero<T: Copy>(x: T) -> T;
/// Reverses the bytes in an integer type `T`. /// Reverses the bytes in an integer type `T`.
/// ///
/// Note that, unlike most intrinsics, this is safe to call; /// Note that, unlike most intrinsics, this is safe to call;
@ -2186,7 +2153,6 @@ extern "rust-intrinsic" {
/// large and difficult to optimize. /// large and difficult to optimize.
/// ///
/// The stabilized version of this intrinsic is [`Ord::cmp`]. /// The stabilized version of this intrinsic is [`Ord::cmp`].
#[cfg(not(bootstrap))]
#[rustc_const_unstable(feature = "const_three_way_compare", issue = "none")] #[rustc_const_unstable(feature = "const_three_way_compare", issue = "none")]
#[rustc_safe_intrinsic] #[rustc_safe_intrinsic]
pub fn three_way_compare<T: Copy>(lhs: T, rhs: T) -> crate::cmp::Ordering; pub fn three_way_compare<T: Copy>(lhs: T, rhs: T) -> crate::cmp::Ordering;
@ -2269,7 +2235,6 @@ extern "rust-intrinsic" {
/// Safe wrappers for this intrinsic are available on the integer /// Safe wrappers for this intrinsic are available on the integer
/// primitives via the `checked_shl` method. For example, /// primitives via the `checked_shl` method. For example,
/// [`u32::checked_shl`] /// [`u32::checked_shl`]
#[cfg(not(bootstrap))]
#[rustc_const_stable(feature = "const_int_unchecked", since = "1.40.0")] #[rustc_const_stable(feature = "const_int_unchecked", since = "1.40.0")]
#[rustc_nounwind] #[rustc_nounwind]
pub fn unchecked_shl<T: Copy, U: Copy>(x: T, y: U) -> T; pub fn unchecked_shl<T: Copy, U: Copy>(x: T, y: U) -> T;
@ -2279,7 +2244,6 @@ extern "rust-intrinsic" {
/// Safe wrappers for this intrinsic are available on the integer /// Safe wrappers for this intrinsic are available on the integer
/// primitives via the `checked_shr` method. For example, /// primitives via the `checked_shr` method. For example,
/// [`u32::checked_shr`] /// [`u32::checked_shr`]
#[cfg(not(bootstrap))]
#[rustc_const_stable(feature = "const_int_unchecked", since = "1.40.0")] #[rustc_const_stable(feature = "const_int_unchecked", since = "1.40.0")]
#[rustc_nounwind] #[rustc_nounwind]
pub fn unchecked_shr<T: Copy, U: Copy>(x: T, y: U) -> T; pub fn unchecked_shr<T: Copy, U: Copy>(x: T, y: U) -> T;
@ -2321,18 +2285,11 @@ extern "rust-intrinsic" {
/// The stabilized versions of this intrinsic are available on the integer /// The stabilized versions of this intrinsic are available on the integer
/// primitives via the `rotate_left` method. For example, /// primitives via the `rotate_left` method. For example,
/// [`u32::rotate_left`] /// [`u32::rotate_left`]
#[cfg(not(bootstrap))]
#[rustc_const_stable(feature = "const_int_rotate", since = "1.40.0")] #[rustc_const_stable(feature = "const_int_rotate", since = "1.40.0")]
#[rustc_safe_intrinsic] #[rustc_safe_intrinsic]
#[rustc_nounwind] #[rustc_nounwind]
pub fn rotate_left<T: Copy>(x: T, shift: u32) -> T; pub fn rotate_left<T: Copy>(x: T, shift: u32) -> T;
#[cfg(bootstrap)]
#[rustc_const_stable(feature = "const_int_rotate", since = "1.40.0")]
#[rustc_safe_intrinsic]
#[rustc_nounwind]
pub fn rotate_left<T: Copy>(x: T, y: T) -> T;
/// Performs rotate right. /// Performs rotate right.
/// ///
/// Note that, unlike most intrinsics, this is safe to call; /// Note that, unlike most intrinsics, this is safe to call;
@ -2343,18 +2300,11 @@ extern "rust-intrinsic" {
/// The stabilized versions of this intrinsic are available on the integer /// The stabilized versions of this intrinsic are available on the integer
/// primitives via the `rotate_right` method. For example, /// primitives via the `rotate_right` method. For example,
/// [`u32::rotate_right`] /// [`u32::rotate_right`]
#[cfg(not(bootstrap))]
#[rustc_const_stable(feature = "const_int_rotate", since = "1.40.0")] #[rustc_const_stable(feature = "const_int_rotate", since = "1.40.0")]
#[rustc_safe_intrinsic] #[rustc_safe_intrinsic]
#[rustc_nounwind] #[rustc_nounwind]
pub fn rotate_right<T: Copy>(x: T, shift: u32) -> T; pub fn rotate_right<T: Copy>(x: T, shift: u32) -> T;
#[cfg(bootstrap)]
#[rustc_const_stable(feature = "const_int_rotate", since = "1.40.0")]
#[rustc_safe_intrinsic]
#[rustc_nounwind]
pub fn rotate_right<T: Copy>(x: T, y: T) -> T;
/// Returns (a + b) mod 2<sup>N</sup>, where N is the width of T in bits. /// Returns (a + b) mod 2<sup>N</sup>, where N is the width of T in bits.
/// ///
/// Note that, unlike most intrinsics, this is safe to call; /// Note that, unlike most intrinsics, this is safe to call;
@ -2507,12 +2457,6 @@ extern "rust-intrinsic" {
#[rustc_const_unstable(feature = "const_ptr_sub_ptr", issue = "95892")] #[rustc_const_unstable(feature = "const_ptr_sub_ptr", issue = "95892")]
#[rustc_nounwind] #[rustc_nounwind]
pub fn ptr_offset_from_unsigned<T>(ptr: *const T, base: *const T) -> usize; pub fn ptr_offset_from_unsigned<T>(ptr: *const T, base: *const T) -> usize;
#[rustc_const_unstable(feature = "const_raw_ptr_comparison", issue = "53020")]
#[rustc_safe_intrinsic]
#[rustc_nounwind]
#[cfg(bootstrap)]
pub fn ptr_guaranteed_cmp<T>(ptr: *const T, other: *const T) -> u8;
} }
/// See documentation of `<*const T>::guaranteed_eq` for details. /// See documentation of `<*const T>::guaranteed_eq` for details.
@ -2522,7 +2466,6 @@ extern "rust-intrinsic" {
#[rustc_const_unstable(feature = "const_raw_ptr_comparison", issue = "53020")] #[rustc_const_unstable(feature = "const_raw_ptr_comparison", issue = "53020")]
#[unstable(feature = "core_intrinsics", issue = "none")] #[unstable(feature = "core_intrinsics", issue = "none")]
#[rustc_intrinsic] #[rustc_intrinsic]
#[cfg(not(bootstrap))]
#[rustc_nounwind] #[rustc_nounwind]
#[rustc_do_not_const_check] #[rustc_do_not_const_check]
#[inline] #[inline]
@ -2581,28 +2524,6 @@ extern "rust-intrinsic" {
#[rustc_safe_intrinsic] #[rustc_safe_intrinsic]
#[rustc_nounwind] #[rustc_nounwind]
pub fn black_box<T>(dummy: T) -> T; pub fn black_box<T>(dummy: T) -> T;
#[rustc_nounwind]
#[cfg(bootstrap)]
pub fn vtable_size(ptr: *const ()) -> usize;
/// `ptr` must point to a vtable.
/// The intrinsic will return the alignment stored in that vtable.
#[rustc_nounwind]
#[cfg(bootstrap)]
pub fn vtable_align(ptr: *const ()) -> usize;
#[rustc_const_unstable(feature = "const_eval_select", issue = "none")]
#[rustc_safe_intrinsic]
#[cfg(bootstrap)]
pub fn const_eval_select<ARG: Tuple, F, G, RET>(
arg: ARG,
called_in_const: F,
called_at_rt: G,
) -> RET
where
G: FnOnce<ARG, Output = RET>,
F: FnOnce<ARG, Output = RET>;
} }
/// Selects which function to call depending on the context. /// Selects which function to call depending on the context.
@ -2637,11 +2558,9 @@ extern "rust-intrinsic" {
/// #![feature(const_eval_select)] /// #![feature(const_eval_select)]
/// #![feature(core_intrinsics)] /// #![feature(core_intrinsics)]
/// # #![allow(internal_features)] /// # #![allow(internal_features)]
/// # #![cfg_attr(bootstrap, allow(unused))]
/// use std::intrinsics::const_eval_select; /// use std::intrinsics::const_eval_select;
/// ///
/// // Standard library /// // Standard library
/// # #[cfg(not(bootstrap))]
/// pub const fn inconsistent() -> i32 { /// pub const fn inconsistent() -> i32 {
/// fn runtime() -> i32 { 1 } /// fn runtime() -> i32 { 1 }
/// const fn compiletime() -> i32 { 2 } /// const fn compiletime() -> i32 { 2 }
@ -2650,8 +2569,6 @@ extern "rust-intrinsic" {
/// // and `runtime`. /// // and `runtime`.
/// const_eval_select((), compiletime, runtime) /// const_eval_select((), compiletime, runtime)
/// } /// }
/// # #[cfg(bootstrap)]
/// # pub const fn inconsistent() -> i32 { 0 }
/// ///
/// // User Crate /// // User Crate
/// const X: i32 = inconsistent(); /// const X: i32 = inconsistent();
@ -2663,7 +2580,6 @@ extern "rust-intrinsic" {
/// otherwise, that principle should not be violated. /// otherwise, that principle should not be violated.
#[rustc_const_unstable(feature = "const_eval_select", issue = "none")] #[rustc_const_unstable(feature = "const_eval_select", issue = "none")]
#[unstable(feature = "core_intrinsics", issue = "none")] #[unstable(feature = "core_intrinsics", issue = "none")]
#[cfg(not(bootstrap))]
#[rustc_intrinsic] #[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden] #[rustc_intrinsic_must_be_overridden]
pub const fn const_eval_select<ARG: Tuple, F, G, RET>( pub const fn const_eval_select<ARG: Tuple, F, G, RET>(
@ -2776,7 +2692,7 @@ pub const fn is_val_statically_known<T: Copy>(_arg: T) -> bool {
/// `x` and `y` are readable and writable as `T`, and non-overlapping. /// `x` and `y` are readable and writable as `T`, and non-overlapping.
#[rustc_nounwind] #[rustc_nounwind]
#[inline] #[inline]
#[cfg_attr(not(bootstrap), rustc_intrinsic)] #[rustc_intrinsic]
// This has fallback `const fn` MIR, so shouldn't need stability, see #122652 // This has fallback `const fn` MIR, so shouldn't need stability, see #122652
#[rustc_const_unstable(feature = "const_typed_swap", issue = "none")] #[rustc_const_unstable(feature = "const_typed_swap", issue = "none")]
pub const unsafe fn typed_swap<T>(x: *mut T, y: *mut T) { pub const unsafe fn typed_swap<T>(x: *mut T, y: *mut T) {
@ -2801,7 +2717,7 @@ pub const unsafe fn typed_swap<T>(x: *mut T, y: *mut T) {
#[rustc_const_unstable(feature = "const_ub_checks", issue = "none")] #[rustc_const_unstable(feature = "const_ub_checks", issue = "none")]
#[unstable(feature = "core_intrinsics", issue = "none")] #[unstable(feature = "core_intrinsics", issue = "none")]
#[inline(always)] #[inline(always)]
#[cfg_attr(not(bootstrap), rustc_intrinsic)] // just make it a regular fn in bootstrap #[rustc_intrinsic]
pub const fn ub_checks() -> bool { pub const fn ub_checks() -> bool {
cfg!(debug_assertions) cfg!(debug_assertions)
} }
@ -2845,7 +2761,6 @@ pub const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize)
#[unstable(feature = "core_intrinsics", issue = "none")] #[unstable(feature = "core_intrinsics", issue = "none")]
#[rustc_intrinsic] #[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden] #[rustc_intrinsic_must_be_overridden]
#[cfg(not(bootstrap))]
pub unsafe fn vtable_size(_ptr: *const ()) -> usize { pub unsafe fn vtable_size(_ptr: *const ()) -> usize {
unreachable!() unreachable!()
} }
@ -2856,7 +2771,6 @@ pub unsafe fn vtable_size(_ptr: *const ()) -> usize {
#[unstable(feature = "core_intrinsics", issue = "none")] #[unstable(feature = "core_intrinsics", issue = "none")]
#[rustc_intrinsic] #[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden] #[rustc_intrinsic_must_be_overridden]
#[cfg(not(bootstrap))]
pub unsafe fn vtable_align(_ptr: *const ()) -> usize { pub unsafe fn vtable_align(_ptr: *const ()) -> usize {
unreachable!() unreachable!()
} }
@ -2871,7 +2785,6 @@ pub unsafe fn vtable_align(_ptr: *const ()) -> usize {
#[rustc_const_unstable(feature = "ptr_metadata", issue = "81513")] #[rustc_const_unstable(feature = "ptr_metadata", issue = "81513")]
#[rustc_intrinsic] #[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden] #[rustc_intrinsic_must_be_overridden]
#[cfg(not(bootstrap))]
pub const fn aggregate_raw_ptr<P: AggregateRawPtr<D, Metadata = M>, D, M>(_data: D, _meta: M) -> P { pub const fn aggregate_raw_ptr<P: AggregateRawPtr<D, Metadata = M>, D, M>(_data: D, _meta: M) -> P {
// To implement a fallback we'd have to assume the layout of the pointer, // To implement a fallback we'd have to assume the layout of the pointer,
// but the whole point of this intrinsic is that we shouldn't do that. // but the whole point of this intrinsic is that we shouldn't do that.

View file

@ -540,12 +540,8 @@ extern "rust-intrinsic" {
/// `T` must be a vector of pointers. /// `T` must be a vector of pointers.
/// ///
/// `U` must be a vector of `usize` with the same length as `T`. /// `U` must be a vector of `usize` with the same length as `T`.
#[cfg(not(bootstrap))]
#[rustc_nounwind] #[rustc_nounwind]
pub fn simd_expose_provenance<T, U>(ptr: T) -> U; pub fn simd_expose_provenance<T, U>(ptr: T) -> U;
#[cfg(bootstrap)]
#[rustc_nounwind]
pub fn simd_expose_addr<T, U>(ptr: T) -> U;
/// Create a vector of pointers from a vector of addresses. /// Create a vector of pointers from a vector of addresses.
/// ///
@ -553,11 +549,7 @@ extern "rust-intrinsic" {
/// ///
/// `U` must be a vector of pointers, with the same length as `T`. /// `U` must be a vector of pointers, with the same length as `T`.
#[rustc_nounwind] #[rustc_nounwind]
#[cfg(not(bootstrap))]
pub fn simd_with_exposed_provenance<T, U>(addr: T) -> U; pub fn simd_with_exposed_provenance<T, U>(addr: T) -> U;
#[rustc_nounwind]
#[cfg(bootstrap)]
pub fn simd_from_exposed_addr<T, U>(addr: T) -> U;
/// Swap bytes of each element. /// Swap bytes of each element.
/// ///
@ -663,8 +655,3 @@ extern "rust-intrinsic" {
#[rustc_nounwind] #[rustc_nounwind]
pub fn simd_flog<T>(a: T) -> T; pub fn simd_flog<T>(a: T) -> T;
} }
#[cfg(bootstrap)]
pub use simd_expose_addr as simd_expose_provenance;
#[cfg(bootstrap)]
pub use simd_from_exposed_addr as simd_with_exposed_provenance;

View file

@ -14,7 +14,7 @@ use crate::pin::Pin;
/// #![feature(coroutines)] /// #![feature(coroutines)]
/// #![feature(iter_from_coroutine)] /// #![feature(iter_from_coroutine)]
/// ///
/// let it = std::iter::from_coroutine(#[cfg_attr(not(bootstrap), coroutine)] || { /// let it = std::iter::from_coroutine(#[coroutine] || {
/// yield 1; /// yield 1;
/// yield 2; /// yield 2;
/// yield 3; /// yield 3;

View file

@ -28,7 +28,7 @@ pub unsafe trait TrustedFused {}
#[rustc_unsafe_specialization_marker] #[rustc_unsafe_specialization_marker]
// FIXME: this should be a #[marker] and have another blanket impl for T: TrustedFused // FIXME: this should be a #[marker] and have another blanket impl for T: TrustedFused
// but that ICEs iter::Fuse specializations. // but that ICEs iter::Fuse specializations.
#[cfg_attr(not(bootstrap), lang = "fused_iterator")] #[lang = "fused_iterator"]
pub trait FusedIterator: Iterator {} pub trait FusedIterator: Iterator {}
#[stable(feature = "fused", since = "1.26.0")] #[stable(feature = "fused", since = "1.26.0")]

View file

@ -90,7 +90,7 @@
))] ))]
#![no_core] #![no_core]
#![rustc_coherence_is_core] #![rustc_coherence_is_core]
#![cfg_attr(not(bootstrap), rustc_preserve_ub_checks)] #![rustc_preserve_ub_checks]
// //
// Lints: // Lints:
#![deny(rust_2021_incompatible_or_patterns)] #![deny(rust_2021_incompatible_or_patterns)]
@ -109,7 +109,6 @@
// //
// Library features: // Library features:
// tidy-alphabetical-start // tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![feature(array_ptr_get)] #![feature(array_ptr_get)]
#![feature(asm_experimental_arch)] #![feature(asm_experimental_arch)]
#![feature(char_indices_offset)] #![feature(char_indices_offset)]
@ -201,7 +200,6 @@
// //
// Language features: // Language features:
// tidy-alphabetical-start // tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(inline_const))]
#![feature(abi_unadjusted)] #![feature(abi_unadjusted)]
#![feature(adt_const_params)] #![feature(adt_const_params)]
#![feature(allow_internal_unsafe)] #![feature(allow_internal_unsafe)]
@ -402,7 +400,6 @@ pub mod net;
pub mod option; pub mod option;
pub mod panic; pub mod panic;
pub mod panicking; pub mod panicking;
#[cfg(not(bootstrap))]
#[unstable(feature = "core_pattern_types", issue = "none")] #[unstable(feature = "core_pattern_types", issue = "none")]
pub mod pat; pub mod pat;
pub mod pin; pub mod pin;

View file

@ -1715,7 +1715,6 @@ pub(crate) mod builtin {
builtin # type_ascribe($expr, $ty) builtin # type_ascribe($expr, $ty)
} }
#[cfg(not(bootstrap))]
/// Unstable placeholder for deref patterns. /// Unstable placeholder for deref patterns.
#[allow_internal_unstable(builtin_syntax)] #[allow_internal_unstable(builtin_syntax)]
#[unstable( #[unstable(

View file

@ -1234,18 +1234,9 @@ macro_rules! int_impl {
#[inline(always)] #[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn unchecked_shl(self, rhs: u32) -> Self { pub const unsafe fn unchecked_shl(self, rhs: u32) -> Self {
#[cfg(bootstrap)]
{
// For bootstrapping, just use built-in primitive shift.
// panicking is a legal manifestation of UB
self << rhs
}
#[cfg(not(bootstrap))]
{
// SAFETY: the caller must uphold the safety contract for // SAFETY: the caller must uphold the safety contract for
// `unchecked_shl`. // `unchecked_shl`.
unsafe { intrinsics::unchecked_shl(self, rhs) } unsafe { intrinsics::unchecked_shl(self, rhs) }
}
} }
/// Checked shift right. Computes `self >> rhs`, returning `None` if `rhs` is /// Checked shift right. Computes `self >> rhs`, returning `None` if `rhs` is
@ -1332,18 +1323,9 @@ macro_rules! int_impl {
#[inline(always)] #[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn unchecked_shr(self, rhs: u32) -> Self { pub const unsafe fn unchecked_shr(self, rhs: u32) -> Self {
#[cfg(bootstrap)] // SAFETY: the caller must uphold the safety contract for
{ // `unchecked_shr`.
// For bootstrapping, just use built-in primitive shift. unsafe { intrinsics::unchecked_shr(self, rhs) }
// panicking is a legal manifestation of UB
self >> rhs
}
#[cfg(not(bootstrap))]
{
// SAFETY: the caller must uphold the safety contract for
// `unchecked_shr`.
unsafe { intrinsics::unchecked_shr(self, rhs) }
}
} }
/// Checked absolute value. Computes `self.abs()`, returning `None` if /// Checked absolute value. Computes `self.abs()`, returning `None` if

View file

@ -528,10 +528,7 @@ macro_rules! nonzero_integer {
pub const fn leading_zeros(self) -> u32 { pub const fn leading_zeros(self) -> u32 {
// SAFETY: since `self` cannot be zero, it is safe to call `ctlz_nonzero`. // SAFETY: since `self` cannot be zero, it is safe to call `ctlz_nonzero`.
unsafe { unsafe {
#[cfg(not(bootstrap))] intrinsics::ctlz_nonzero(self.get() as $UnsignedPrimitive)
return intrinsics::ctlz_nonzero(self.get() as $UnsignedPrimitive);
#[cfg(bootstrap)]
return intrinsics::ctlz_nonzero(self.get() as $UnsignedPrimitive) as u32;
} }
} }
@ -557,10 +554,7 @@ macro_rules! nonzero_integer {
pub const fn trailing_zeros(self) -> u32 { pub const fn trailing_zeros(self) -> u32 {
// SAFETY: since `self` cannot be zero, it is safe to call `cttz_nonzero`. // SAFETY: since `self` cannot be zero, it is safe to call `cttz_nonzero`.
unsafe { unsafe {
#[cfg(not(bootstrap))] intrinsics::cttz_nonzero(self.get() as $UnsignedPrimitive)
return intrinsics::cttz_nonzero(self.get() as $UnsignedPrimitive);
#[cfg(bootstrap)]
return intrinsics::cttz_nonzero(self.get() as $UnsignedPrimitive) as u32;
} }
} }

View file

@ -77,10 +77,7 @@ macro_rules! uint_impl {
without modifying the original"] without modifying the original"]
#[inline(always)] #[inline(always)]
pub const fn count_ones(self) -> u32 { pub const fn count_ones(self) -> u32 {
#[cfg(not(bootstrap))]
return intrinsics::ctpop(self as $ActualT); return intrinsics::ctpop(self as $ActualT);
#[cfg(bootstrap)]
return intrinsics::ctpop(self as $ActualT) as u32;
} }
/// Returns the number of zeros in the binary representation of `self`. /// Returns the number of zeros in the binary representation of `self`.
@ -122,10 +119,7 @@ macro_rules! uint_impl {
without modifying the original"] without modifying the original"]
#[inline(always)] #[inline(always)]
pub const fn leading_zeros(self) -> u32 { pub const fn leading_zeros(self) -> u32 {
#[cfg(not(bootstrap))]
return intrinsics::ctlz(self as $ActualT); return intrinsics::ctlz(self as $ActualT);
#[cfg(bootstrap)]
return intrinsics::ctlz(self as $ActualT) as u32;
} }
/// Returns the number of trailing zeros in the binary representation /// Returns the number of trailing zeros in the binary representation
@ -146,10 +140,7 @@ macro_rules! uint_impl {
without modifying the original"] without modifying the original"]
#[inline(always)] #[inline(always)]
pub const fn trailing_zeros(self) -> u32 { pub const fn trailing_zeros(self) -> u32 {
#[cfg(not(bootstrap))]
return intrinsics::cttz(self); return intrinsics::cttz(self);
#[cfg(bootstrap)]
return intrinsics::cttz(self) as u32;
} }
/// Returns the number of leading ones in the binary representation of `self`. /// Returns the number of leading ones in the binary representation of `self`.
@ -214,10 +205,7 @@ macro_rules! uint_impl {
without modifying the original"] without modifying the original"]
#[inline(always)] #[inline(always)]
pub const fn rotate_left(self, n: u32) -> Self { pub const fn rotate_left(self, n: u32) -> Self {
#[cfg(not(bootstrap))]
return intrinsics::rotate_left(self, n); return intrinsics::rotate_left(self, n);
#[cfg(bootstrap)]
return intrinsics::rotate_left(self, n as $SelfT);
} }
/// Shifts the bits to the right by a specified amount, `n`, /// Shifts the bits to the right by a specified amount, `n`,
@ -242,10 +230,7 @@ macro_rules! uint_impl {
without modifying the original"] without modifying the original"]
#[inline(always)] #[inline(always)]
pub const fn rotate_right(self, n: u32) -> Self { pub const fn rotate_right(self, n: u32) -> Self {
#[cfg(not(bootstrap))]
return intrinsics::rotate_right(self, n); return intrinsics::rotate_right(self, n);
#[cfg(bootstrap)]
return intrinsics::rotate_right(self, n as $SelfT);
} }
/// Reverses the byte order of the integer. /// Reverses the byte order of the integer.
@ -1324,18 +1309,9 @@ macro_rules! uint_impl {
#[inline(always)] #[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn unchecked_shl(self, rhs: u32) -> Self { pub const unsafe fn unchecked_shl(self, rhs: u32) -> Self {
#[cfg(bootstrap)] // SAFETY: the caller must uphold the safety contract for
{ // `unchecked_shl`.
// For bootstrapping, just use built-in primitive shift. unsafe { intrinsics::unchecked_shl(self, rhs) }
// panicking is a legal manifestation of UB
self << rhs
}
#[cfg(not(bootstrap))]
{
// SAFETY: the caller must uphold the safety contract for
// `unchecked_shl`.
unsafe { intrinsics::unchecked_shl(self, rhs) }
}
} }
/// Checked shift right. Computes `self >> rhs`, returning `None` /// Checked shift right. Computes `self >> rhs`, returning `None`
@ -1422,18 +1398,9 @@ macro_rules! uint_impl {
#[inline(always)] #[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn unchecked_shr(self, rhs: u32) -> Self { pub const unsafe fn unchecked_shr(self, rhs: u32) -> Self {
#[cfg(bootstrap)]
{
// For bootstrapping, just use built-in primitive shift.
// panicking is a legal manifestation of UB
self >> rhs
}
#[cfg(not(bootstrap))]
{
// SAFETY: the caller must uphold the safety contract for // SAFETY: the caller must uphold the safety contract for
// `unchecked_shr`. // `unchecked_shr`.
unsafe { intrinsics::unchecked_shr(self, rhs) } unsafe { intrinsics::unchecked_shr(self, rhs) }
}
} }
/// Checked exponentiation. Computes `self.pow(exp)`, returning `None` if /// Checked exponentiation. Computes `self.pow(exp)`, returning `None` if

View file

@ -46,7 +46,7 @@ pub enum CoroutineState<Y, R> {
/// use std::pin::Pin; /// use std::pin::Pin;
/// ///
/// fn main() { /// fn main() {
/// let mut coroutine = #[cfg_attr(not(bootstrap), coroutine)] || { /// let mut coroutine = #[coroutine] || {
/// yield 1; /// yield 1;
/// "foo" /// "foo"
/// }; /// };

View file

@ -285,7 +285,7 @@ impl<T: ?Sized> DerefMut for &mut T {
/// is concerned. Calls to `deref`/`deref_mut`` must leave the pointer itself likewise /// is concerned. Calls to `deref`/`deref_mut`` must leave the pointer itself likewise
/// unchanged. /// unchanged.
#[unstable(feature = "deref_pure_trait", issue = "87121")] #[unstable(feature = "deref_pure_trait", issue = "87121")]
#[cfg_attr(not(bootstrap), lang = "deref_pure")] #[lang = "deref_pure"]
pub unsafe trait DerefPure {} pub unsafe trait DerefPure {}
#[unstable(feature = "deref_pure_trait", issue = "87121")] #[unstable(feature = "deref_pure_trait", issue = "87121")]

View file

@ -240,7 +240,6 @@ pub trait Drop {
} }
/// Fallback function to call surface level `Drop::drop` function /// Fallback function to call surface level `Drop::drop` function
#[cfg(not(bootstrap))]
#[allow(drop_bounds)] #[allow(drop_bounds)]
#[lang = "fallback_surface_drop"] #[lang = "fallback_surface_drop"]
pub(crate) fn fallback_surface_drop<T: Drop + ?Sized>(x: &mut T) { pub(crate) fn fallback_surface_drop<T: Drop + ?Sized>(x: &mut T) {

View file

@ -174,7 +174,6 @@ pub use self::deref::Receiver;
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub use self::drop::Drop; pub use self::drop::Drop;
#[cfg(not(bootstrap))]
pub(crate) use self::drop::fallback_surface_drop; pub(crate) use self::drop::fallback_surface_drop;
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]

View file

@ -156,7 +156,6 @@ pub const fn panic(expr: &'static str) -> ! {
// reducing binary size impact. // reducing binary size impact.
macro_rules! panic_const { macro_rules! panic_const {
($($lang:ident = $message:expr,)+) => { ($($lang:ident = $message:expr,)+) => {
#[cfg(not(bootstrap))]
pub mod panic_const { pub mod panic_const {
use super::*; use super::*;

View file

@ -1809,7 +1809,7 @@ impl<Ptr, U> DispatchFromDyn<Pin<U>> for Pin<Ptr> where Ptr: DispatchFromDyn<U>
/// fn coroutine_fn() -> impl Coroutine<Yield = usize, Return = ()> /* not Unpin */ { /// fn coroutine_fn() -> impl Coroutine<Yield = usize, Return = ()> /* not Unpin */ {
/// // Allow coroutine to be self-referential (not `Unpin`) /// // Allow coroutine to be self-referential (not `Unpin`)
/// // vvvvvv so that locals can cross yield points. /// // vvvvvv so that locals can cross yield points.
/// #[cfg_attr(not(bootstrap), coroutine)] static || { /// #[coroutine] static || {
/// let foo = String::from("foo"); /// let foo = String::from("foo");
/// let foo_ref = &foo; // ------+ /// let foo_ref = &foo; // ------+
/// yield 0; // | <- crosses yield point! /// yield 0; // | <- crosses yield point!

View file

@ -97,7 +97,6 @@ pub use crate::macros::builtin::cfg_eval;
)] )]
pub use crate::macros::builtin::type_ascribe; pub use crate::macros::builtin::type_ascribe;
#[cfg(not(bootstrap))]
#[unstable( #[unstable(
feature = "deref_patterns", feature = "deref_patterns",
issue = "87121", issue = "87121",

View file

@ -2,7 +2,6 @@
use crate::fmt; use crate::fmt;
use crate::hash::{Hash, Hasher}; use crate::hash::{Hash, Hasher};
#[cfg(not(bootstrap))]
use crate::intrinsics::aggregate_raw_ptr; use crate::intrinsics::aggregate_raw_ptr;
use crate::marker::Freeze; use crate::marker::Freeze;
@ -115,17 +114,7 @@ pub const fn from_raw_parts<T: ?Sized>(
data_pointer: *const (), data_pointer: *const (),
metadata: <T as Pointee>::Metadata, metadata: <T as Pointee>::Metadata,
) -> *const T { ) -> *const T {
#[cfg(bootstrap)] aggregate_raw_ptr(data_pointer, metadata)
{
// SAFETY: Accessing the value from the `PtrRepr` union is safe since *const T
// and PtrComponents<T> have the same memory layouts. Only std can make this
// guarantee.
unsafe { PtrRepr { components: PtrComponents { data_pointer, metadata } }.const_ptr }
}
#[cfg(not(bootstrap))]
{
aggregate_raw_ptr(data_pointer, metadata)
}
} }
/// Performs the same functionality as [`from_raw_parts`], except that a /// Performs the same functionality as [`from_raw_parts`], except that a
@ -139,17 +128,7 @@ pub const fn from_raw_parts_mut<T: ?Sized>(
data_pointer: *mut (), data_pointer: *mut (),
metadata: <T as Pointee>::Metadata, metadata: <T as Pointee>::Metadata,
) -> *mut T { ) -> *mut T {
#[cfg(bootstrap)] aggregate_raw_ptr(data_pointer, metadata)
{
// SAFETY: Accessing the value from the `PtrRepr` union is safe since *const T
// and PtrComponents<T> have the same memory layouts. Only std can make this
// guarantee.
unsafe { PtrRepr { components: PtrComponents { data_pointer, metadata } }.mut_ptr }
}
#[cfg(not(bootstrap))]
{
aggregate_raw_ptr(data_pointer, metadata)
}
} }
#[repr(C)] #[repr(C)]

View file

@ -1784,15 +1784,6 @@ pub(crate) const unsafe fn align_offset<T: Sized>(p: *const T, a: usize) -> usiz
assume, cttz_nonzero, exact_div, mul_with_overflow, unchecked_rem, unchecked_sub, assume, cttz_nonzero, exact_div, mul_with_overflow, unchecked_rem, unchecked_sub,
wrapping_add, wrapping_mul, wrapping_sub, wrapping_add, wrapping_mul, wrapping_sub,
}; };
#[cfg(bootstrap)]
const unsafe fn unchecked_shl(value: usize, shift: usize) -> usize {
value << shift
}
#[cfg(bootstrap)]
const unsafe fn unchecked_shr(value: usize, shift: usize) -> usize {
value >> shift
}
#[cfg(not(bootstrap))]
use intrinsics::{unchecked_shl, unchecked_shr}; use intrinsics::{unchecked_shl, unchecked_shr};
/// Calculate multiplicative modular inverse of `x` modulo `m`. /// Calculate multiplicative modular inverse of `x` modulo `m`.

View file

@ -512,7 +512,6 @@ impl AtomicBool {
/// ///
/// ``` /// ```
/// #![feature(atomic_from_mut)] /// #![feature(atomic_from_mut)]
/// # #![cfg_attr(bootstrap, feature(inline_const))]
/// use std::sync::atomic::{AtomicBool, Ordering}; /// use std::sync::atomic::{AtomicBool, Ordering};
/// ///
/// let mut some_bools = [const { AtomicBool::new(false) }; 10]; /// let mut some_bools = [const { AtomicBool::new(false) }; 10];
@ -1315,7 +1314,6 @@ impl<T> AtomicPtr<T> {
/// ///
/// ``` /// ```
/// #![feature(atomic_from_mut)] /// #![feature(atomic_from_mut)]
/// # #![cfg_attr(bootstrap, feature(inline_const))]
/// use std::ptr::null_mut; /// use std::ptr::null_mut;
/// use std::sync::atomic::{AtomicPtr, Ordering}; /// use std::sync::atomic::{AtomicPtr, Ordering};
/// ///
@ -2306,7 +2304,6 @@ macro_rules! atomic_int {
/// ///
/// ``` /// ```
/// #![feature(atomic_from_mut)] /// #![feature(atomic_from_mut)]
/// # #![cfg_attr(bootstrap, feature(inline_const))]
#[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")] #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")]
/// ///
#[doc = concat!("let mut some_ints = [const { ", stringify!($atomic_type), "::new(0) }; 10];")] #[doc = concat!("let mut some_ints = [const { ", stringify!($atomic_type), "::new(0) }; 10];")]

View file

@ -100,7 +100,6 @@ fn test_const_deallocate_at_runtime() {
} }
} }
#[cfg(not(bootstrap))]
#[test] #[test]
fn test_three_way_compare_in_const_contexts() { fn test_three_way_compare_in_const_contexts() {
use core::cmp::Ordering::{self, *}; use core::cmp::Ordering::{self, *};

View file

@ -21,7 +21,7 @@
#![feature(const_pointer_is_aligned)] #![feature(const_pointer_is_aligned)]
#![feature(const_ptr_as_ref)] #![feature(const_ptr_as_ref)]
#![feature(const_ptr_write)] #![feature(const_ptr_write)]
#![cfg_attr(not(bootstrap), feature(const_three_way_compare))] #![feature(const_three_way_compare)]
#![feature(const_trait_impl)] #![feature(const_trait_impl)]
#![feature(const_likely)] #![feature(const_likely)]
#![feature(core_intrinsics)] #![feature(core_intrinsics)]
@ -46,7 +46,6 @@
#![feature(hasher_prefixfree_extras)] #![feature(hasher_prefixfree_extras)]
#![feature(hashmap_internals)] #![feature(hashmap_internals)]
#![feature(try_find)] #![feature(try_find)]
#![cfg_attr(bootstrap, feature(inline_const))]
#![feature(is_sorted)] #![feature(is_sorted)]
#![feature(layout_for_ptr)] #![feature(layout_for_ptr)]
#![feature(pattern)] #![feature(pattern)]

View file

@ -224,7 +224,7 @@
`#![no_std]` or overriding this warning by enabling this feature." `#![no_std]` or overriding this warning by enabling this feature."
) )
)] )]
#![cfg_attr(not(bootstrap), rustc_preserve_ub_checks)] #![rustc_preserve_ub_checks]
#![doc( #![doc(
html_playground_url = "https://play.rust-lang.org/", html_playground_url = "https://play.rust-lang.org/",
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/", issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
@ -592,7 +592,6 @@ pub mod net;
pub mod num; pub mod num;
pub mod os; pub mod os;
pub mod panic; pub mod panic;
#[cfg(not(bootstrap))]
#[unstable(feature = "core_pattern_types", issue = "none")] #[unstable(feature = "core_pattern_types", issue = "none")]
pub mod pat; pub mod pat;
pub mod path; pub mod path;

View file

@ -84,7 +84,6 @@ pub use core::prelude::v1::cfg_eval;
)] )]
pub use core::prelude::v1::type_ascribe; pub use core::prelude::v1::type_ascribe;
#[cfg(not(bootstrap))]
// Do not `doc(no_inline)` either. // Do not `doc(no_inline)` either.
#[unstable( #[unstable(
feature = "deref_patterns", feature = "deref_patterns",

View file

@ -2124,13 +2124,10 @@ impl<'a> Builder<'a> {
// during incremental builds" heuristic for the standard library. // during incremental builds" heuristic for the standard library.
rustflags.arg("-Zinline-mir"); rustflags.arg("-Zinline-mir");
// FIXME: always pass this after the next `#[cfg(bootstrap)]` update. // Similarly, we need to keep debug info for functions inlined into other std functions,
if compiler.stage != 0 { // even if we're not going to output debuginfo for the crate we're currently building,
// Similarly, we need to keep debug info for functions inlined into other std functions, // so that it'll be available when downstream consumers of std try to use it.
// even if we're not going to output debuginfo for the crate we're currently building, rustflags.arg("-Zinline-mir-preserve-debug");
// so that it'll be available when downstream consumers of std try to use it.
rustflags.arg("-Zinline-mir-preserve-debug");
}
} }
if self.config.rustc_parallel if self.config.rustc_parallel