diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index d51961c65b7..f5fb6f0b4d0 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -89,12 +89,16 @@ fn main() { let mut cmd = Command::new(rustc); cmd.args(&args) - .arg("--cfg") - .arg(format!("stage{}", stage)) .env(bootstrap::util::dylib_path_var(), env::join_paths(&dylib_path).unwrap()); let mut maybe_crate = None; + // Non-zero stages must all be treated uniformly to avoid problems when attempting to uplift + // compiler libraries and such from stage 1 to 2. + if stage == "0" { + cmd.arg("--cfg").arg("bootstrap"); + } + // 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/compile.rs b/src/bootstrap/compile.rs index 4515c7d672d..c7fa8e788b5 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -341,7 +341,7 @@ impl Step for StartupObjects { if !up_to_date(src_file, dst_file) { let mut cmd = Command::new(&builder.initial_rustc); builder.run(cmd.env("RUSTC_BOOTSTRAP", "1") - .arg("--cfg").arg("stage0") + .arg("--cfg").arg("bootstrap") .arg("--target").arg(target) .arg("--emit=obj") .arg("-o").arg(dst_file) diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 31a4e380a3d..84867264e70 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -1242,17 +1242,17 @@ extern "rust-intrinsic" { /// Returns the result of an unchecked addition, resulting in /// undefined behavior when `x + y > T::max_value()` or `x + y < T::min_value()`. - #[cfg(not(stage0))] + #[cfg(not(bootstrap))] pub fn unchecked_add(x: T, y: T) -> T; /// Returns the result of an unchecked substraction, resulting in /// undefined behavior when `x - y > T::max_value()` or `x - y < T::min_value()`. - #[cfg(not(stage0))] + #[cfg(not(bootstrap))] pub fn unchecked_sub(x: T, y: T) -> T; /// Returns the result of an unchecked multiplication, resulting in /// undefined behavior when `x * y > T::max_value()` or `x * y < T::min_value()`. - #[cfg(not(stage0))] + #[cfg(not(bootstrap))] pub fn unchecked_mul(x: T, y: T) -> T; /// Performs rotate left. diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 7145bf1fbc0..dd7090623f5 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -50,7 +50,7 @@ assert_eq!(size_of::>(), size_of::<", s #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] #[repr(transparent)] #[rustc_layout_scalar_valid_range_start(1)] - #[cfg_attr(not(stage0), rustc_nonnull_optimization_guaranteed)] + #[cfg_attr(not(bootstrap), rustc_nonnull_optimization_guaranteed)] pub struct $Ty($Int); } diff --git a/src/libcore/ptr/non_null.rs b/src/libcore/ptr/non_null.rs index 0a6985e334c..46dde7c1da5 100644 --- a/src/libcore/ptr/non_null.rs +++ b/src/libcore/ptr/non_null.rs @@ -38,7 +38,7 @@ use crate::cmp::Ordering; #[stable(feature = "nonnull", since = "1.25.0")] #[repr(transparent)] #[rustc_layout_scalar_valid_range_start(1)] -#[cfg_attr(not(stage0), rustc_nonnull_optimization_guaranteed)] +#[cfg_attr(not(bootstrap), rustc_nonnull_optimization_guaranteed)] pub struct NonNull { pointer: *const T, }