diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2019-09-09 10:27:01 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2019-09-23 09:34:44 -0700 |
| commit | b3f95f460f6c35985bf7b3e6220b1370e0323312 (patch) | |
| tree | 53230792239f993da4a9bd6673a703945240e247 | |
| parent | a816fa185b42bc1bd73cd241be27121dcc5b784b (diff) | |
| download | rust-b3f95f460f6c35985bf7b3e6220b1370e0323312.tar.gz rust-b3f95f460f6c35985bf7b3e6220b1370e0323312.zip | |
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.
| -rw-r--r-- | src/bootstrap/bin/rustc.rs | 15 | ||||
| -rw-r--r-- | src/bootstrap/builder.rs | 1 | ||||
| -rw-r--r-- | src/libcore/bool.rs | 2 | ||||
| -rw-r--r-- | src/libcore/clone.rs | 2 | ||||
| -rw-r--r-- | src/libcore/cmp.rs | 8 | ||||
| -rw-r--r-- | src/libcore/default.rs | 2 | ||||
| -rw-r--r-- | src/libcore/fmt/mod.rs | 6 | ||||
| -rw-r--r-- | src/libcore/hash/mod.rs | 2 | ||||
| -rw-r--r-- | src/libcore/intrinsics.rs | 12 | ||||
| -rw-r--r-- | src/libcore/lib.rs | 2 | ||||
| -rw-r--r-- | src/libcore/macros.rs | 4 | ||||
| -rw-r--r-- | src/libcore/marker.rs | 2 | ||||
| -rw-r--r-- | src/libcore/num/mod.rs | 24 | ||||
| m--------- | src/stdarch | 0 |
14 files changed, 34 insertions, 48 deletions
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index b71119cc57c..528e7787610 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -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"); diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 6a483c1fafd..076947f8781 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -820,6 +820,7 @@ impl<'a> Builder<'a> { rustflags.env("RUSTFLAGS_NOT_BOOTSTRAP"); } else { rustflags.env("RUSTFLAGS_BOOTSTRAP"); + rustflags.arg("--cfg=bootstrap"); } match mode { diff --git a/src/libcore/bool.rs b/src/libcore/bool.rs index 32ec26975e3..f751ccb4280 100644 --- a/src/libcore/bool.rs +++ b/src/libcore/bool.rs @@ -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. diff --git a/src/libcore/clone.rs b/src/libcore/clone.rs index ec70d396e96..6bdae1b557d 100644 --- a/src/libcore/clone.rs +++ b/src/libcore/clone.rs @@ -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 */ } diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index 4e2b1627e15..fc7329f57d4 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -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 */ } diff --git a/src/libcore/default.rs b/src/libcore/default.rs index 66acc5165fc..806d4783107 100644 --- a/src/libcore/default.rs +++ b/src/libcore/default.rs @@ -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 */ } diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 7e35188bc10..65e2f8b9be6 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -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 */ } diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs index bf3daa32840..aaaa6f9c575 100644 --- a/src/libcore/hash/mod.rs +++ b/src/libcore/hash/mod.rs @@ -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 */ } diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index ecff40a7597..905375eb60f 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -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. diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index a2cc585fc51..5c681b3a5d8 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -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)] diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index 384bc874998..c6f5fb0b163 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -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] diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index 347e7dce6e6..a2cfb320e76 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -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 */ } diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 0cf2ebb487d..5d99c10e738 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -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) } } diff --git a/src/stdarch b/src/stdarch -Subproject 4791ba85e7645c02146dd416288480943670d1c +Subproject e0ab2c165ace03a61139b61f1d9b86b07028850 |
