Skip to content

Commit 81d01fe

Browse files
committed
Auto merge of rust-lang#137373 - Kobzol:tool-stage0-improve, r=<try>
Compile run-make-support and run-make tests with the bootstrap compiler It does not seem necessary to have to recompile run-make-support on changes to the local compiler/stdlib. This PR simplifies the implementation of a few tools, then switches rms to stage0 and also makes the handling of environment variables in run-make tests simpler. Best reviewed commit-by-commit. I can split it into multiple PRs if you want. Based on: rust-lang#137215 r? `@jieyouxu` try-job: x86_64-apple-1 try-job: x86_64-apple-2 try-job: aarch64-apple try-job: x86_64-msvc-1 try-job: x86_64-msvc-2 try-job: x86_64-mingw-1 try-job: x86_64-mingw-2
2 parents 9f48ded + 3f27d09 commit 81d01fe

File tree

23 files changed

+451
-503
lines changed

23 files changed

+451
-503
lines changed

src/bootstrap/defaults/config.tools.toml

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ incremental = true
88
download-rustc = "if-unchanged"
99

1010
[build]
11+
# cargo and clippy tests don't pass on stage 1
12+
test-stage = 2
1113
# Document with the in-tree rustdoc by default, since `download-rustc` makes it quick to compile.
1214
doc-stage = 2
1315
# Contributors working on tools will probably expect compiler docs to be generated, so they can figure out how to use the API.

src/bootstrap/src/core/build_steps/compile.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -1977,13 +1977,14 @@ impl Step for Assemble {
19771977
let maybe_install_llvm_bitcode_linker = |compiler| {
19781978
if builder.config.llvm_bitcode_linker_enabled {
19791979
trace!("llvm-bitcode-linker enabled, installing");
1980-
let src_path = builder.ensure(crate::core::build_steps::tool::LlvmBitcodeLinker {
1981-
compiler,
1982-
target: target_compiler.host,
1983-
extra_features: vec![],
1984-
});
1980+
let llvm_bitcode_linker =
1981+
builder.ensure(crate::core::build_steps::tool::LlvmBitcodeLinker {
1982+
compiler,
1983+
target: target_compiler.host,
1984+
extra_features: vec![],
1985+
});
19851986
let tool_exe = exe("llvm-bitcode-linker", target_compiler.host);
1986-
builder.copy_link(&src_path, &libdir_bin.join(tool_exe));
1987+
builder.copy_link(&llvm_bitcode_linker.tool_path, &libdir_bin.join(tool_exe));
19871988
}
19881989
};
19891990

@@ -2171,14 +2172,13 @@ impl Step for Assemble {
21712172
// logic to create the final binary. This is used by the
21722173
// `wasm32-wasip2` target of Rust.
21732174
if builder.tool_enabled("wasm-component-ld") {
2174-
let wasm_component_ld_exe =
2175-
builder.ensure(crate::core::build_steps::tool::WasmComponentLd {
2176-
compiler: build_compiler,
2177-
target: target_compiler.host,
2178-
});
2175+
let wasm_component = builder.ensure(crate::core::build_steps::tool::WasmComponentLd {
2176+
compiler: build_compiler,
2177+
target: target_compiler.host,
2178+
});
21792179
builder.copy_link(
2180-
&wasm_component_ld_exe,
2181-
&libdir_bin.join(wasm_component_ld_exe.file_name().unwrap()),
2180+
&wasm_component.tool_path,
2181+
&libdir_bin.join(wasm_component.tool_path.file_name().unwrap()),
21822182
);
21832183
}
21842184

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

+11-11
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ impl Step for Rustc {
430430
},
431431
builder.kind,
432432
) {
433-
builder.install(&ra_proc_macro_srv, &image.join("libexec"), 0o755);
433+
builder.install(&ra_proc_macro_srv.tool_path, &image.join("libexec"), 0o755);
434434
}
435435

436436
let libdir_relative = builder.libdir_relative(compiler);
@@ -1145,7 +1145,7 @@ impl Step for Cargo {
11451145
let mut tarball = Tarball::new(builder, "cargo", &target.triple);
11461146
tarball.set_overlay(OverlayKind::Cargo);
11471147

1148-
tarball.add_file(cargo, "bin", 0o755);
1148+
tarball.add_file(cargo.tool_path, "bin", 0o755);
11491149
tarball.add_file(etc.join("_cargo"), "share/zsh/site-functions", 0o644);
11501150
tarball.add_renamed_file(etc.join("cargo.bashcomp.sh"), "etc/bash_completion.d", "cargo");
11511151
tarball.add_dir(etc.join("man"), "share/man/man1");
@@ -1191,7 +1191,7 @@ impl Step for Rls {
11911191
let mut tarball = Tarball::new(builder, "rls", &target.triple);
11921192
tarball.set_overlay(OverlayKind::Rls);
11931193
tarball.is_preview(true);
1194-
tarball.add_file(rls, "bin", 0o755);
1194+
tarball.add_file(rls.tool_path, "bin", 0o755);
11951195
tarball.add_legal_and_readme_to("share/doc/rls");
11961196
Some(tarball.generate())
11971197
}
@@ -1233,7 +1233,7 @@ impl Step for RustAnalyzer {
12331233
let mut tarball = Tarball::new(builder, "rust-analyzer", &target.triple);
12341234
tarball.set_overlay(OverlayKind::RustAnalyzer);
12351235
tarball.is_preview(true);
1236-
tarball.add_file(rust_analyzer, "bin", 0o755);
1236+
tarball.add_file(rust_analyzer.tool_path, "bin", 0o755);
12371237
tarball.add_legal_and_readme_to("share/doc/rust-analyzer");
12381238
Some(tarball.generate())
12391239
}
@@ -1279,8 +1279,8 @@ impl Step for Clippy {
12791279
let mut tarball = Tarball::new(builder, "clippy", &target.triple);
12801280
tarball.set_overlay(OverlayKind::Clippy);
12811281
tarball.is_preview(true);
1282-
tarball.add_file(clippy, "bin", 0o755);
1283-
tarball.add_file(cargoclippy, "bin", 0o755);
1282+
tarball.add_file(clippy.tool_path, "bin", 0o755);
1283+
tarball.add_file(cargoclippy.tool_path, "bin", 0o755);
12841284
tarball.add_legal_and_readme_to("share/doc/clippy");
12851285
Some(tarball.generate())
12861286
}
@@ -1329,8 +1329,8 @@ impl Step for Miri {
13291329
let mut tarball = Tarball::new(builder, "miri", &target.triple);
13301330
tarball.set_overlay(OverlayKind::Miri);
13311331
tarball.is_preview(true);
1332-
tarball.add_file(miri, "bin", 0o755);
1333-
tarball.add_file(cargomiri, "bin", 0o755);
1332+
tarball.add_file(miri.tool_path, "bin", 0o755);
1333+
tarball.add_file(cargomiri.tool_path, "bin", 0o755);
13341334
tarball.add_legal_and_readme_to("share/doc/miri");
13351335
Some(tarball.generate())
13361336
}
@@ -1460,8 +1460,8 @@ impl Step for Rustfmt {
14601460
let mut tarball = Tarball::new(builder, "rustfmt", &target.triple);
14611461
tarball.set_overlay(OverlayKind::Rustfmt);
14621462
tarball.is_preview(true);
1463-
tarball.add_file(rustfmt, "bin", 0o755);
1464-
tarball.add_file(cargofmt, "bin", 0o755);
1463+
tarball.add_file(rustfmt.tool_path, "bin", 0o755);
1464+
tarball.add_file(cargofmt.tool_path, "bin", 0o755);
14651465
tarball.add_legal_and_readme_to("share/doc/rustfmt");
14661466
Some(tarball.generate())
14671467
}
@@ -2283,7 +2283,7 @@ impl Step for LlvmBitcodeLinker {
22832283
tarball.set_overlay(OverlayKind::LlvmBitcodeLinker);
22842284
tarball.is_preview(true);
22852285

2286-
tarball.add_file(llbc_linker, self_contained_bin_dir, 0o755);
2286+
tarball.add_file(llbc_linker.tool_path, self_contained_bin_dir, 0o755);
22872287

22882288
Some(tarball.generate())
22892289
}

src/bootstrap/src/core/build_steps/perf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ Consider setting `rust.debuginfo-level = 1` in `config.toml`."#);
166166
let results_dir = rustc_perf_dir.join("results");
167167
builder.create_dir(&results_dir);
168168

169-
let mut cmd = command(collector);
169+
let mut cmd = command(collector.tool_path);
170170

171171
// We need to set the working directory to `src/tools/rustc-perf`, so that it can find the directory
172172
// with compile-time benchmarks.

src/bootstrap/src/core/build_steps/run.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,7 @@ impl Step for Miri {
126126

127127
// This compiler runs on the host, we'll just use it for the target.
128128
let target_compiler = builder.compiler(stage, host);
129-
// Similar to `compile::Assemble`, build with the previous stage's compiler. Otherwise
130-
// we'd have stageN/bin/rustc and stageN/bin/rustdoc be effectively different stage
131-
// compilers, which isn't what we want. Rustdoc should be linked in the same way as the
132-
// rustc compiler it's paired with, so it must be built with the previous stage compiler.
133-
let host_compiler = builder.compiler(stage - 1, host);
129+
let host_compiler = tool::get_tool_rustc_compiler(builder, target_compiler);
134130

135131
// Get a target sysroot for Miri.
136132
let miri_sysroot = test::Miri::build_miri_sysroot(builder, target_compiler, target);

0 commit comments

Comments
 (0)