Skip to content

Commit b3f95f4

Browse files
committed
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.
1 parent a816fa1 commit b3f95f4

File tree

14 files changed

+35
-49
lines changed

14 files changed

+35
-49
lines changed

src/bootstrap/bin/rustc.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,21 +76,6 @@ fn main() {
7676
}
7777
}
7878

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

src/bootstrap/builder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,7 @@ impl<'a> Builder<'a> {
820820
rustflags.env("RUSTFLAGS_NOT_BOOTSTRAP");
821821
} else {
822822
rustflags.env("RUSTFLAGS_BOOTSTRAP");
823+
rustflags.arg("--cfg=bootstrap");
823824
}
824825

825826
match mode {

src/libcore/bool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! impl bool {}
22
3-
#[cfg(not(boostrap_stdarch_ignore_this))]
3+
#[cfg(not(bootstrap))]
44
#[lang = "bool"]
55
impl bool {
66
/// Returns `Some(t)` if the `bool` is `true`, or `None` otherwise.

src/libcore/clone.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ pub trait Clone : Sized {
135135

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

src/libcore/cmp.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ pub trait PartialEq<Rhs: ?Sized = Self> {
210210

211211
/// Derive macro generating an impl of the trait `PartialEq`.
212212
#[rustc_builtin_macro]
213-
#[cfg_attr(boostrap_stdarch_ignore_this, rustc_macro_transparency = "semitransparent")]
213+
#[cfg_attr(bootstrap, rustc_macro_transparency = "semitransparent")]
214214
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
215215
#[allow_internal_unstable(core_intrinsics)]
216216
pub macro PartialEq($item:item) { /* compiler built-in */ }
@@ -273,7 +273,7 @@ pub trait Eq: PartialEq<Self> {
273273

274274
/// Derive macro generating an impl of the trait `Eq`.
275275
#[rustc_builtin_macro]
276-
#[cfg_attr(boostrap_stdarch_ignore_this, rustc_macro_transparency = "semitransparent")]
276+
#[cfg_attr(bootstrap, rustc_macro_transparency = "semitransparent")]
277277
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
278278
#[allow_internal_unstable(core_intrinsics, derive_eq)]
279279
pub macro Eq($item:item) { /* compiler built-in */ }
@@ -624,7 +624,7 @@ pub trait Ord: Eq + PartialOrd<Self> {
624624

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

874874
/// Derive macro generating an impl of the trait `PartialOrd`.
875875
#[rustc_builtin_macro]
876-
#[cfg_attr(boostrap_stdarch_ignore_this, rustc_macro_transparency = "semitransparent")]
876+
#[cfg_attr(bootstrap, rustc_macro_transparency = "semitransparent")]
877877
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
878878
#[allow_internal_unstable(core_intrinsics)]
879879
pub macro PartialOrd($item:item) { /* compiler built-in */ }

src/libcore/default.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ pub trait Default: Sized {
117117

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

src/libcore/fmt/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -518,8 +518,8 @@ impl Display for Arguments<'_> {
518518
label="`{Self}` cannot be formatted using `{{:?}}` because it doesn't implement `{Debug}`",
519519
)]
520520
#[doc(alias = "{:?}")]
521-
#[cfg_attr(boostrap_stdarch_ignore_this, lang = "debug_trait")]
522-
#[cfg_attr(not(boostrap_stdarch_ignore_this), rustc_diagnostic_item = "debug_trait")]
521+
#[cfg_attr(bootstrap, lang = "debug_trait")]
522+
#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "debug_trait")]
523523
pub trait Debug {
524524
/// Formats the value using the given formatter.
525525
///
@@ -550,7 +550,7 @@ pub trait Debug {
550550
pub(crate) mod macros {
551551
/// Derive macro generating an impl of the trait `Debug`.
552552
#[rustc_builtin_macro]
553-
#[cfg_attr(boostrap_stdarch_ignore_this, rustc_macro_transparency = "semitransparent")]
553+
#[cfg_attr(bootstrap, rustc_macro_transparency = "semitransparent")]
554554
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
555555
#[allow_internal_unstable(core_intrinsics)]
556556
pub macro Debug($item:item) { /* compiler built-in */ }

src/libcore/hash/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ pub trait Hash {
202202
pub(crate) mod macros {
203203
/// Derive macro generating an impl of the trait `Hash`.
204204
#[rustc_builtin_macro]
205-
#[cfg_attr(boostrap_stdarch_ignore_this, rustc_macro_transparency = "semitransparent")]
205+
#[cfg_attr(bootstrap, rustc_macro_transparency = "semitransparent")]
206206
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
207207
#[allow_internal_unstable(core_intrinsics)]
208208
pub macro Hash($item:item) { /* compiler built-in */ }

src/libcore/intrinsics.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,38 +1299,38 @@ extern "rust-intrinsic" {
12991299
/// The stabilized versions of this intrinsic are available on the integer
13001300
/// primitives via the `wrapping_add` method. For example,
13011301
/// [`std::u32::wrapping_add`](../../std/primitive.u32.html#method.wrapping_add)
1302-
#[cfg(boostrap_stdarch_ignore_this)]
1302+
#[cfg(bootstrap)]
13031303
pub fn overflowing_add<T>(a: T, b: T) -> T;
13041304
/// Returns (a - b) mod 2<sup>N</sup>, where N is the width of T in bits.
13051305
/// The stabilized versions of this intrinsic are available on the integer
13061306
/// primitives via the `wrapping_sub` method. For example,
13071307
/// [`std::u32::wrapping_sub`](../../std/primitive.u32.html#method.wrapping_sub)
1308-
#[cfg(boostrap_stdarch_ignore_this)]
1308+
#[cfg(bootstrap)]
13091309
pub fn overflowing_sub<T>(a: T, b: T) -> T;
13101310
/// Returns (a * b) mod 2<sup>N</sup>, where N is the width of T in bits.
13111311
/// The stabilized versions of this intrinsic are available on the integer
13121312
/// primitives via the `wrapping_mul` method. For example,
13131313
/// [`std::u32::wrapping_mul`](../../std/primitive.u32.html#method.wrapping_mul)
1314-
#[cfg(boostrap_stdarch_ignore_this)]
1314+
#[cfg(bootstrap)]
13151315
pub fn overflowing_mul<T>(a: T, b: T) -> T;
13161316

13171317
/// Returns (a + b) mod 2<sup>N</sup>, where N is the width of T in bits.
13181318
/// The stabilized versions of this intrinsic are available on the integer
13191319
/// primitives via the `wrapping_add` method. For example,
13201320
/// [`std::u32::wrapping_add`](../../std/primitive.u32.html#method.wrapping_add)
1321-
#[cfg(not(boostrap_stdarch_ignore_this))]
1321+
#[cfg(not(bootstrap))]
13221322
pub fn wrapping_add<T>(a: T, b: T) -> T;
13231323
/// Returns (a - b) mod 2<sup>N</sup>, where N is the width of T in bits.
13241324
/// The stabilized versions of this intrinsic are available on the integer
13251325
/// primitives via the `wrapping_sub` method. For example,
13261326
/// [`std::u32::wrapping_sub`](../../std/primitive.u32.html#method.wrapping_sub)
1327-
#[cfg(not(boostrap_stdarch_ignore_this))]
1327+
#[cfg(not(bootstrap))]
13281328
pub fn wrapping_sub<T>(a: T, b: T) -> T;
13291329
/// Returns (a * b) mod 2<sup>N</sup>, where N is the width of T in bits.
13301330
/// The stabilized versions of this intrinsic are available on the integer
13311331
/// primitives via the `wrapping_mul` method. For example,
13321332
/// [`std::u32::wrapping_mul`](../../std/primitive.u32.html#method.wrapping_mul)
1333-
#[cfg(not(boostrap_stdarch_ignore_this))]
1333+
#[cfg(not(bootstrap))]
13341334
pub fn wrapping_mul<T>(a: T, b: T) -> T;
13351335

13361336
/// Computes `a + b`, while saturating at numeric bounds.

src/libcore/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
#![feature(link_llvm_intrinsics)]
8888
#![feature(never_type)]
8989
#![feature(nll)]
90-
#![cfg_attr(boostrap_stdarch_ignore_this, feature(bind_by_move_pattern_guards))]
90+
#![cfg_attr(bootstrap, feature(bind_by_move_pattern_guards))]
9191
#![feature(exhaustive_patterns)]
9292
#![feature(no_core)]
9393
#![feature(on_unimplemented)]

src/libcore/macros.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,9 +1236,9 @@ pub(crate) mod builtin {
12361236
pub macro test($item:item) { /* compiler built-in */ }
12371237

12381238
/// Attribute macro applied to a function to turn it into a benchmark test.
1239-
#[cfg_attr(not(boostrap_stdarch_ignore_this), unstable(soft, feature = "test", issue = "50297",
1239+
#[cfg_attr(not(bootstrap), unstable(soft, feature = "test", issue = "50297",
12401240
reason = "`bench` is a part of custom test frameworks which are unstable"))]
1241-
#[cfg_attr(boostrap_stdarch_ignore_this, unstable(feature = "test", issue = "50297",
1241+
#[cfg_attr(bootstrap, unstable(feature = "test", issue = "50297",
12421242
reason = "`bench` is a part of custom test frameworks which are unstable"))]
12431243
#[allow_internal_unstable(test, rustc_attrs)]
12441244
#[rustc_builtin_macro]

src/libcore/marker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ pub trait Copy : Clone {
290290

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

src/libcore/num/mod.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,11 +1112,11 @@ $EndFeature, "
11121112
without modifying the original"]
11131113
#[inline]
11141114
pub const fn wrapping_add(self, rhs: Self) -> Self {
1115-
#[cfg(boostrap_stdarch_ignore_this)] {
1115+
#[cfg(bootstrap)] {
11161116
intrinsics::overflowing_add(self, rhs)
11171117
}
11181118

1119-
#[cfg(not(boostrap_stdarch_ignore_this))] {
1119+
#[cfg(not(bootstrap))] {
11201120
intrinsics::wrapping_add(self, rhs)
11211121
}
11221122
}
@@ -1141,11 +1141,11 @@ $EndFeature, "
11411141
without modifying the original"]
11421142
#[inline]
11431143
pub const fn wrapping_sub(self, rhs: Self) -> Self {
1144-
#[cfg(boostrap_stdarch_ignore_this)] {
1144+
#[cfg(bootstrap)] {
11451145
intrinsics::overflowing_sub(self, rhs)
11461146
}
11471147

1148-
#[cfg(not(boostrap_stdarch_ignore_this))] {
1148+
#[cfg(not(bootstrap))] {
11491149
intrinsics::wrapping_sub(self, rhs)
11501150
}
11511151
}
@@ -1169,11 +1169,11 @@ $EndFeature, "
11691169
without modifying the original"]
11701170
#[inline]
11711171
pub const fn wrapping_mul(self, rhs: Self) -> Self {
1172-
#[cfg(boostrap_stdarch_ignore_this)] {
1172+
#[cfg(bootstrap)] {
11731173
intrinsics::overflowing_mul(self, rhs)
11741174
}
11751175

1176-
#[cfg(not(boostrap_stdarch_ignore_this))] {
1176+
#[cfg(not(bootstrap))] {
11771177
intrinsics::wrapping_mul(self, rhs)
11781178
}
11791179
}
@@ -3040,11 +3040,11 @@ $EndFeature, "
30403040
without modifying the original"]
30413041
#[inline]
30423042
pub const fn wrapping_add(self, rhs: Self) -> Self {
3043-
#[cfg(boostrap_stdarch_ignore_this)] {
3043+
#[cfg(bootstrap)] {
30443044
intrinsics::overflowing_add(self, rhs)
30453045
}
30463046

3047-
#[cfg(not(boostrap_stdarch_ignore_this))] {
3047+
#[cfg(not(bootstrap))] {
30483048
intrinsics::wrapping_add(self, rhs)
30493049
}
30503050
}
@@ -3068,11 +3068,11 @@ $EndFeature, "
30683068
without modifying the original"]
30693069
#[inline]
30703070
pub const fn wrapping_sub(self, rhs: Self) -> Self {
3071-
#[cfg(boostrap_stdarch_ignore_this)] {
3071+
#[cfg(bootstrap)] {
30723072
intrinsics::overflowing_sub(self, rhs)
30733073
}
30743074

3075-
#[cfg(not(boostrap_stdarch_ignore_this))] {
3075+
#[cfg(not(bootstrap))] {
30763076
intrinsics::wrapping_sub(self, rhs)
30773077
}
30783078
}
@@ -3097,11 +3097,11 @@ $EndFeature, "
30973097
without modifying the original"]
30983098
#[inline]
30993099
pub const fn wrapping_mul(self, rhs: Self) -> Self {
3100-
#[cfg(boostrap_stdarch_ignore_this)] {
3100+
#[cfg(bootstrap)] {
31013101
intrinsics::overflowing_mul(self, rhs)
31023102
}
31033103

3104-
#[cfg(not(boostrap_stdarch_ignore_this))] {
3104+
#[cfg(not(bootstrap))] {
31053105
intrinsics::wrapping_mul(self, rhs)
31063106
}
31073107
}

0 commit comments

Comments
 (0)