Skip to content

Commit d04d56d

Browse files
Utilize cfg(bootstrap) over cfg(stage0)
Also removes stage1, stage2 cfgs being passed to rustc to ensure that stage1 and stage2 are only differentiated as a group (i.e., only through not bootstrap).
1 parent 7096ff0 commit d04d56d

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

src/bootstrap/bin/rustc.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,16 @@ fn main() {
8989

9090
let mut cmd = Command::new(rustc);
9191
cmd.args(&args)
92-
.arg("--cfg")
93-
.arg(format!("stage{}", stage))
9492
.env(bootstrap::util::dylib_path_var(),
9593
env::join_paths(&dylib_path).unwrap());
9694
let mut maybe_crate = None;
9795

96+
// Non-zero stages must all be treated uniformly to avoid problems when attempting to uplift
97+
// compiler libraries and such from stage 1 to 2.
98+
if stage == "0" {
99+
cmd.arg("--cfg").arg("bootstrap");
100+
}
101+
98102
// Print backtrace in case of ICE
99103
if env::var("RUSTC_BACKTRACE_ON_ICE").is_ok() && env::var("RUST_BACKTRACE").is_err() {
100104
cmd.env("RUST_BACKTRACE", "1");

src/bootstrap/compile.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ impl Step for StartupObjects {
341341
if !up_to_date(src_file, dst_file) {
342342
let mut cmd = Command::new(&builder.initial_rustc);
343343
builder.run(cmd.env("RUSTC_BOOTSTRAP", "1")
344-
.arg("--cfg").arg("stage0")
344+
.arg("--cfg").arg("bootstrap")
345345
.arg("--target").arg(target)
346346
.arg("--emit=obj")
347347
.arg("-o").arg(dst_file)

src/libcore/num/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ assert_eq!(size_of::<Option<core::num::", stringify!($Ty), ">>(), size_of::<", s
5050
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5151
#[repr(transparent)]
5252
#[rustc_layout_scalar_valid_range_start(1)]
53-
#[cfg_attr(not(stage0), rustc_nonnull_optimization_guaranteed)]
53+
#[cfg_attr(not(bootstrap), rustc_nonnull_optimization_guaranteed)]
5454
pub struct $Ty($Int);
5555
}
5656

src/libcore/ptr/non_null.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use crate::cmp::Ordering;
3838
#[stable(feature = "nonnull", since = "1.25.0")]
3939
#[repr(transparent)]
4040
#[rustc_layout_scalar_valid_range_start(1)]
41-
#[cfg_attr(not(stage0), rustc_nonnull_optimization_guaranteed)]
41+
#[cfg_attr(not(bootstrap), rustc_nonnull_optimization_guaranteed)]
4242
pub struct NonNull<T: ?Sized> {
4343
pointer: *const T,
4444
}

0 commit comments

Comments
 (0)