Move --cfg bootstrap out of rustc.rs

Instead let's do this via `RUSTFLAGS` in `builder.rs`. Currently
requires a submodule update of `stdarch` to fix a problem with previous
compilers.
This commit is contained in:
Alex Crichton 2019-09-09 10:27:01 -07:00
parent a816fa185b
commit b3f95f460f
14 changed files with 35 additions and 49 deletions

View File

@ -76,21 +76,6 @@ fn main() {
}
}
// Non-zero stages must all be treated uniformly to avoid problems when attempting to uplift
// compiler libraries and such from stage 1 to 2.
//
// FIXME: the fact that core here is excluded is due to core_arch from our stdarch submodule
// being broken on the beta compiler with bootstrap passed, so this is a temporary workaround
// (we've just snapped, so there are no cfg(bootstrap) related annotations in core).
if stage == "0" {
if crate_name != Some("core") {
cmd.arg("--cfg").arg("bootstrap");
} else {
// NOTE(eddyb) see FIXME above, except now we need annotations again in core.
cmd.arg("--cfg").arg("boostrap_stdarch_ignore_this");
}
}
// Print backtrace in case of ICE
if env::var("RUSTC_BACKTRACE_ON_ICE").is_ok() && env::var("RUST_BACKTRACE").is_err() {
cmd.env("RUST_BACKTRACE", "1");

View File

@ -820,6 +820,7 @@ impl<'a> Builder<'a> {
rustflags.env("RUSTFLAGS_NOT_BOOTSTRAP");
} else {
rustflags.env("RUSTFLAGS_BOOTSTRAP");
rustflags.arg("--cfg=bootstrap");
}
match mode {

View File

@ -1,6 +1,6 @@
//! impl bool {}
#[cfg(not(boostrap_stdarch_ignore_this))]
#[cfg(not(bootstrap))]
#[lang = "bool"]
impl bool {
/// Returns `Some(t)` if the `bool` is `true`, or `None` otherwise.

View File

@ -135,7 +135,7 @@ pub trait Clone : Sized {
/// Derive macro generating an impl of the trait `Clone`.
#[rustc_builtin_macro]
#[cfg_attr(boostrap_stdarch_ignore_this, rustc_macro_transparency = "semitransparent")]
#[cfg_attr(bootstrap, rustc_macro_transparency = "semitransparent")]
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
#[allow_internal_unstable(core_intrinsics, derive_clone_copy)]
pub macro Clone($item:item) { /* compiler built-in */ }

View File

@ -210,7 +210,7 @@ pub trait PartialEq<Rhs: ?Sized = Self> {
/// Derive macro generating an impl of the trait `PartialEq`.
#[rustc_builtin_macro]
#[cfg_attr(boostrap_stdarch_ignore_this, rustc_macro_transparency = "semitransparent")]
#[cfg_attr(bootstrap, rustc_macro_transparency = "semitransparent")]
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
#[allow_internal_unstable(core_intrinsics)]
pub macro PartialEq($item:item) { /* compiler built-in */ }
@ -273,7 +273,7 @@ pub trait Eq: PartialEq<Self> {
/// Derive macro generating an impl of the trait `Eq`.
#[rustc_builtin_macro]
#[cfg_attr(boostrap_stdarch_ignore_this, rustc_macro_transparency = "semitransparent")]
#[cfg_attr(bootstrap, rustc_macro_transparency = "semitransparent")]
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
#[allow_internal_unstable(core_intrinsics, derive_eq)]
pub macro Eq($item:item) { /* compiler built-in */ }
@ -624,7 +624,7 @@ pub trait Ord: Eq + PartialOrd<Self> {
/// Derive macro generating an impl of the trait `Ord`.
#[rustc_builtin_macro]
#[cfg_attr(boostrap_stdarch_ignore_this, rustc_macro_transparency = "semitransparent")]
#[cfg_attr(bootstrap, rustc_macro_transparency = "semitransparent")]
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
#[allow_internal_unstable(core_intrinsics)]
pub macro Ord($item:item) { /* compiler built-in */ }
@ -873,7 +873,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
/// Derive macro generating an impl of the trait `PartialOrd`.
#[rustc_builtin_macro]
#[cfg_attr(boostrap_stdarch_ignore_this, rustc_macro_transparency = "semitransparent")]
#[cfg_attr(bootstrap, rustc_macro_transparency = "semitransparent")]
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
#[allow_internal_unstable(core_intrinsics)]
pub macro PartialOrd($item:item) { /* compiler built-in */ }

View File

@ -117,7 +117,7 @@ pub trait Default: Sized {
/// Derive macro generating an impl of the trait `Default`.
#[rustc_builtin_macro]
#[cfg_attr(boostrap_stdarch_ignore_this, rustc_macro_transparency = "semitransparent")]
#[cfg_attr(bootstrap, rustc_macro_transparency = "semitransparent")]
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
#[allow_internal_unstable(core_intrinsics)]
pub macro Default($item:item) { /* compiler built-in */ }

View File

@ -518,8 +518,8 @@ impl Display for Arguments<'_> {
label="`{Self}` cannot be formatted using `{{:?}}` because it doesn't implement `{Debug}`",
)]
#[doc(alias = "{:?}")]
#[cfg_attr(boostrap_stdarch_ignore_this, lang = "debug_trait")]
#[cfg_attr(not(boostrap_stdarch_ignore_this), rustc_diagnostic_item = "debug_trait")]
#[cfg_attr(bootstrap, lang = "debug_trait")]
#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "debug_trait")]
pub trait Debug {
/// Formats the value using the given formatter.
///
@ -550,7 +550,7 @@ pub trait Debug {
pub(crate) mod macros {
/// Derive macro generating an impl of the trait `Debug`.
#[rustc_builtin_macro]
#[cfg_attr(boostrap_stdarch_ignore_this, rustc_macro_transparency = "semitransparent")]
#[cfg_attr(bootstrap, rustc_macro_transparency = "semitransparent")]
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
#[allow_internal_unstable(core_intrinsics)]
pub macro Debug($item:item) { /* compiler built-in */ }

View File

@ -202,7 +202,7 @@ pub trait Hash {
pub(crate) mod macros {
/// Derive macro generating an impl of the trait `Hash`.
#[rustc_builtin_macro]
#[cfg_attr(boostrap_stdarch_ignore_this, rustc_macro_transparency = "semitransparent")]
#[cfg_attr(bootstrap, rustc_macro_transparency = "semitransparent")]
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
#[allow_internal_unstable(core_intrinsics)]
pub macro Hash($item:item) { /* compiler built-in */ }

View File

@ -1299,38 +1299,38 @@ extern "rust-intrinsic" {
/// The stabilized versions of this intrinsic are available on the integer
/// primitives via the `wrapping_add` method. For example,
/// [`std::u32::wrapping_add`](../../std/primitive.u32.html#method.wrapping_add)
#[cfg(boostrap_stdarch_ignore_this)]
#[cfg(bootstrap)]
pub fn overflowing_add<T>(a: T, b: T) -> T;
/// Returns (a - b) mod 2<sup>N</sup>, where N is the width of T in bits.
/// The stabilized versions of this intrinsic are available on the integer
/// primitives via the `wrapping_sub` method. For example,
/// [`std::u32::wrapping_sub`](../../std/primitive.u32.html#method.wrapping_sub)
#[cfg(boostrap_stdarch_ignore_this)]
#[cfg(bootstrap)]
pub fn overflowing_sub<T>(a: T, b: T) -> T;
/// Returns (a * b) mod 2<sup>N</sup>, where N is the width of T in bits.
/// The stabilized versions of this intrinsic are available on the integer
/// primitives via the `wrapping_mul` method. For example,
/// [`std::u32::wrapping_mul`](../../std/primitive.u32.html#method.wrapping_mul)
#[cfg(boostrap_stdarch_ignore_this)]
#[cfg(bootstrap)]
pub fn overflowing_mul<T>(a: T, b: T) -> T;
/// Returns (a + b) mod 2<sup>N</sup>, where N is the width of T in bits.
/// The stabilized versions of this intrinsic are available on the integer
/// primitives via the `wrapping_add` method. For example,
/// [`std::u32::wrapping_add`](../../std/primitive.u32.html#method.wrapping_add)
#[cfg(not(boostrap_stdarch_ignore_this))]
#[cfg(not(bootstrap))]
pub fn wrapping_add<T>(a: T, b: T) -> T;
/// Returns (a - b) mod 2<sup>N</sup>, where N is the width of T in bits.
/// The stabilized versions of this intrinsic are available on the integer
/// primitives via the `wrapping_sub` method. For example,
/// [`std::u32::wrapping_sub`](../../std/primitive.u32.html#method.wrapping_sub)
#[cfg(not(boostrap_stdarch_ignore_this))]
#[cfg(not(bootstrap))]
pub fn wrapping_sub<T>(a: T, b: T) -> T;
/// Returns (a * b) mod 2<sup>N</sup>, where N is the width of T in bits.
/// The stabilized versions of this intrinsic are available on the integer
/// primitives via the `wrapping_mul` method. For example,
/// [`std::u32::wrapping_mul`](../../std/primitive.u32.html#method.wrapping_mul)
#[cfg(not(boostrap_stdarch_ignore_this))]
#[cfg(not(bootstrap))]
pub fn wrapping_mul<T>(a: T, b: T) -> T;
/// Computes `a + b`, while saturating at numeric bounds.

View File

@ -87,7 +87,7 @@
#![feature(link_llvm_intrinsics)]
#![feature(never_type)]
#![feature(nll)]
#![cfg_attr(boostrap_stdarch_ignore_this, feature(bind_by_move_pattern_guards))]
#![cfg_attr(bootstrap, feature(bind_by_move_pattern_guards))]
#![feature(exhaustive_patterns)]
#![feature(no_core)]
#![feature(on_unimplemented)]

View File

@ -1236,9 +1236,9 @@ pub(crate) mod builtin {
pub macro test($item:item) { /* compiler built-in */ }
/// Attribute macro applied to a function to turn it into a benchmark test.
#[cfg_attr(not(boostrap_stdarch_ignore_this), unstable(soft, feature = "test", issue = "50297",
#[cfg_attr(not(bootstrap), unstable(soft, feature = "test", issue = "50297",
reason = "`bench` is a part of custom test frameworks which are unstable"))]
#[cfg_attr(boostrap_stdarch_ignore_this, unstable(feature = "test", issue = "50297",
#[cfg_attr(bootstrap, unstable(feature = "test", issue = "50297",
reason = "`bench` is a part of custom test frameworks which are unstable"))]
#[allow_internal_unstable(test, rustc_attrs)]
#[rustc_builtin_macro]

View File

@ -290,7 +290,7 @@ pub trait Copy : Clone {
/// Derive macro generating an impl of the trait `Copy`.
#[rustc_builtin_macro]
#[cfg_attr(boostrap_stdarch_ignore_this, rustc_macro_transparency = "semitransparent")]
#[cfg_attr(bootstrap, rustc_macro_transparency = "semitransparent")]
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
#[allow_internal_unstable(core_intrinsics, derive_clone_copy)]
pub macro Copy($item:item) { /* compiler built-in */ }

View File

@ -1112,11 +1112,11 @@ $EndFeature, "
without modifying the original"]
#[inline]
pub const fn wrapping_add(self, rhs: Self) -> Self {
#[cfg(boostrap_stdarch_ignore_this)] {
#[cfg(bootstrap)] {
intrinsics::overflowing_add(self, rhs)
}
#[cfg(not(boostrap_stdarch_ignore_this))] {
#[cfg(not(bootstrap))] {
intrinsics::wrapping_add(self, rhs)
}
}
@ -1141,11 +1141,11 @@ $EndFeature, "
without modifying the original"]
#[inline]
pub const fn wrapping_sub(self, rhs: Self) -> Self {
#[cfg(boostrap_stdarch_ignore_this)] {
#[cfg(bootstrap)] {
intrinsics::overflowing_sub(self, rhs)
}
#[cfg(not(boostrap_stdarch_ignore_this))] {
#[cfg(not(bootstrap))] {
intrinsics::wrapping_sub(self, rhs)
}
}
@ -1169,11 +1169,11 @@ $EndFeature, "
without modifying the original"]
#[inline]
pub const fn wrapping_mul(self, rhs: Self) -> Self {
#[cfg(boostrap_stdarch_ignore_this)] {
#[cfg(bootstrap)] {
intrinsics::overflowing_mul(self, rhs)
}
#[cfg(not(boostrap_stdarch_ignore_this))] {
#[cfg(not(bootstrap))] {
intrinsics::wrapping_mul(self, rhs)
}
}
@ -3040,11 +3040,11 @@ $EndFeature, "
without modifying the original"]
#[inline]
pub const fn wrapping_add(self, rhs: Self) -> Self {
#[cfg(boostrap_stdarch_ignore_this)] {
#[cfg(bootstrap)] {
intrinsics::overflowing_add(self, rhs)
}
#[cfg(not(boostrap_stdarch_ignore_this))] {
#[cfg(not(bootstrap))] {
intrinsics::wrapping_add(self, rhs)
}
}
@ -3068,11 +3068,11 @@ $EndFeature, "
without modifying the original"]
#[inline]
pub const fn wrapping_sub(self, rhs: Self) -> Self {
#[cfg(boostrap_stdarch_ignore_this)] {
#[cfg(bootstrap)] {
intrinsics::overflowing_sub(self, rhs)
}
#[cfg(not(boostrap_stdarch_ignore_this))] {
#[cfg(not(bootstrap))] {
intrinsics::wrapping_sub(self, rhs)
}
}
@ -3097,11 +3097,11 @@ $EndFeature, "
without modifying the original"]
#[inline]
pub const fn wrapping_mul(self, rhs: Self) -> Self {
#[cfg(boostrap_stdarch_ignore_this)] {
#[cfg(bootstrap)] {
intrinsics::overflowing_mul(self, rhs)
}
#[cfg(not(boostrap_stdarch_ignore_this))] {
#[cfg(not(bootstrap))] {
intrinsics::wrapping_mul(self, rhs)
}
}

@ -1 +1 @@
Subproject commit 4791ba85e7645c02146dd416288480943670d1ca
Subproject commit e0ab2c165ace03a61139b61f1d9b86b07028850f