Skip to content

Commit 927bf00

Browse files
committed
Auto merge of rust-lang#140006 - onur-ozkan:138778, r=<try>
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 49e5e4e + 4ba9fff commit 927bf00

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
@@ -408,6 +408,7 @@ mod dist {
408408
use pretty_assertions::assert_eq;
409409

410410
use super::{Config, TEST_TRIPLE_1, TEST_TRIPLE_2, TEST_TRIPLE_3, first, run_build};
411+
use crate::Flags;
411412
use crate::core::builder::*;
412413

413414
fn configure(host: &[&str], target: &[&str]) -> Config {
@@ -646,6 +647,37 @@ mod dist {
646647
);
647648
}
648649

650+
/// This also serves as an important regression test for <https://github.com/rust-lang/rust/issues/138123>
651+
/// and <https://github.com/rust-lang/rust/issues/138004>.
652+
#[test]
653+
fn dist_all_cross() {
654+
let cmd_args =
655+
&["dist", "--stage", "2", "--dry-run", "--config=/does/not/exist"].map(str::to_owned);
656+
let config_str = r#"
657+
[rust]
658+
channel = "nightly"
659+
660+
[build]
661+
extended = true
662+
663+
build = "i686-unknown-haiku"
664+
host = ["i686-unknown-netbsd"]
665+
target = ["i686-unknown-netbsd"]
666+
"#;
667+
let config = Config::parse_inner(Flags::parse(cmd_args), |&_| toml::from_str(config_str));
668+
let mut cache = run_build(&[], config);
669+
670+
// Stage 2 `compile::Rustc` should **NEVER** be cached here.
671+
assert_eq!(
672+
first(cache.all::<compile::Rustc>()),
673+
&[
674+
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
675+
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 1),
676+
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_3, stage = 1),
677+
]
678+
);
679+
}
680+
649681
#[test]
650682
fn build_all() {
651683
let build = Build::new(configure(

0 commit comments

Comments
 (0)