Skip to content

Commit 08db2fa

Browse files
authored
Unrolled build for rust-lang#140006
Rollup merge of rust-lang#140006 - onur-ozkan:138778, r=onur-ozkan ensure compiler existance of tools on the dist step Fixes rust-lang#138778 with a coverage on rust-lang#138123 and rust-lang#138004. try-job: dist-powerpc64le-linux
2 parents 5c54aa7 + 4ba9fff commit 08db2fa

File tree

2 files changed

+50
-5
lines changed

2 files changed

+50
-5
lines changed

src/bootstrap/src/core/build_steps/dist.rs

+18-5
Original file line numberDiff line numberDiff line change
@@ -421,13 +421,13 @@ impl Step for Rustc {
421421
builder.install(&rustdoc, &image.join("bin"), FileType::Executable);
422422
}
423423

424+
let ra_proc_macro_srv_compiler =
425+
builder.compiler_for(compiler.stage, builder.config.build, compiler.host);
426+
builder.ensure(compile::Rustc::new(ra_proc_macro_srv_compiler, compiler.host));
427+
424428
if let Some(ra_proc_macro_srv) = builder.ensure_if_default(
425429
tool::RustAnalyzerProcMacroSrv {
426-
compiler: builder.compiler_for(
427-
compiler.stage,
428-
builder.config.build,
429-
compiler.host,
430-
),
430+
compiler: ra_proc_macro_srv_compiler,
431431
target: compiler.host,
432432
},
433433
builder.kind,
@@ -1178,6 +1178,8 @@ impl Step for Cargo {
11781178
let compiler = self.compiler;
11791179
let target = self.target;
11801180

1181+
builder.ensure(compile::Rustc::new(compiler, target));
1182+
11811183
let cargo = builder.ensure(tool::Cargo { compiler, target });
11821184
let src = builder.src.join("src/tools/cargo");
11831185
let etc = src.join("src/etc");
@@ -1232,6 +1234,8 @@ impl Step for RustAnalyzer {
12321234
let compiler = self.compiler;
12331235
let target = self.target;
12341236

1237+
builder.ensure(compile::Rustc::new(compiler, target));
1238+
12351239
let rust_analyzer = builder.ensure(tool::RustAnalyzer { compiler, target });
12361240

12371241
let mut tarball = Tarball::new(builder, "rust-analyzer", &target.triple);
@@ -1274,6 +1278,8 @@ impl Step for Clippy {
12741278
let compiler = self.compiler;
12751279
let target = self.target;
12761280

1281+
builder.ensure(compile::Rustc::new(compiler, target));
1282+
12771283
// Prepare the image directory
12781284
// We expect clippy to build, because we've exited this step above if tool
12791285
// state for clippy isn't testing.
@@ -1324,9 +1330,12 @@ impl Step for Miri {
13241330
if !builder.build.unstable_features() {
13251331
return None;
13261332
}
1333+
13271334
let compiler = self.compiler;
13281335
let target = self.target;
13291336

1337+
builder.ensure(compile::Rustc::new(compiler, target));
1338+
13301339
let miri = builder.ensure(tool::Miri { compiler, target });
13311340
let cargomiri = builder.ensure(tool::CargoMiri { compiler, target });
13321341

@@ -1463,6 +1472,8 @@ impl Step for Rustfmt {
14631472
let compiler = self.compiler;
14641473
let target = self.target;
14651474

1475+
builder.ensure(compile::Rustc::new(compiler, target));
1476+
14661477
let rustfmt = builder.ensure(tool::Rustfmt { compiler, target });
14671478
let cargofmt = builder.ensure(tool::Cargofmt { compiler, target });
14681479
let mut tarball = Tarball::new(builder, "rustfmt", &target.triple);
@@ -2328,6 +2339,8 @@ impl Step for LlvmBitcodeLinker {
23282339
let compiler = self.compiler;
23292340
let target = self.target;
23302341

2342+
builder.ensure(compile::Rustc::new(compiler, target));
2343+
23312344
let llbc_linker =
23322345
builder.ensure(tool::LlvmBitcodeLinker { compiler, target, extra_features: vec![] });
23332346

src/bootstrap/src/core/builder/tests.rs

+32
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ mod dist {
449449
use pretty_assertions::assert_eq;
450450

451451
use super::{Config, TEST_TRIPLE_1, TEST_TRIPLE_2, TEST_TRIPLE_3, first, run_build};
452+
use crate::Flags;
452453
use crate::core::builder::*;
453454

454455
fn configure(host: &[&str], target: &[&str]) -> Config {
@@ -687,6 +688,37 @@ mod dist {
687688
);
688689
}
689690

691+
/// This also serves as an important regression test for <https://github.com/rust-lang/rust/issues/138123>
692+
/// and <https://github.com/rust-lang/rust/issues/138004>.
693+
#[test]
694+
fn dist_all_cross() {
695+
let cmd_args =
696+
&["dist", "--stage", "2", "--dry-run", "--config=/does/not/exist"].map(str::to_owned);
697+
let config_str = r#"
698+
[rust]
699+
channel = "nightly"
700+
701+
[build]
702+
extended = true
703+
704+
build = "i686-unknown-haiku"
705+
host = ["i686-unknown-netbsd"]
706+
target = ["i686-unknown-netbsd"]
707+
"#;
708+
let config = Config::parse_inner(Flags::parse(cmd_args), |&_| toml::from_str(config_str));
709+
let mut cache = run_build(&[], config);
710+
711+
// Stage 2 `compile::Rustc` should **NEVER** be cached here.
712+
assert_eq!(
713+
first(cache.all::<compile::Rustc>()),
714+
&[
715+
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
716+
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 1),
717+
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_3, stage = 1),
718+
]
719+
);
720+
}
721+
690722
#[test]
691723
fn build_all() {
692724
let build = Build::new(configure(

0 commit comments

Comments
 (0)