Skip to content

Commit ccacb46

Browse files
authored
Rollup merge of #142672 - Kobzol:bootstrap-tool-clarification, r=jieyouxu
Clarify bootstrap tools description The existence of `stage0-bootstrap-tools` suggests the possiblity of `stage1/N-bootstrap-tools`, but that's not really a thing. Also it doesn't fit the new bootstrap model, where `stageN` essentially means that it was built with a `stageN-1` compiler (except for std). r? ``@jieyouxu``
2 parents e6e0826 + 48e52bb commit ccacb46

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

src/bootstrap/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ build/
105105
debuginfo/
106106
...
107107

108+
# Bootstrap host tools (which are always compiled with the stage0 compiler)
109+
# are stored here.
110+
bootstrap-tools/
111+
108112
# Location where the stage0 Cargo and Rust compiler are unpacked. This
109113
# directory is purely an extracted and overlaid tarball of these two (done
110114
# by the bootstrap Python script). In theory, the build system does not

src/bootstrap/src/lib.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,17 @@ pub enum Mode {
246246
/// Build a codegen backend for rustc, placing the output in the "stageN-codegen" directory.
247247
Codegen,
248248

249-
/// Build a tool, placing output in the "stage0-bootstrap-tools"
250-
/// directory. This is for miscellaneous sets of tools that are built
251-
/// using the bootstrap stage0 compiler in its entirety (target libraries
252-
/// and all). Typically these tools compile with stable Rust.
249+
/// Build a tool, placing output in the "bootstrap-tools"
250+
/// directory. This is for miscellaneous sets of tools that extend
251+
/// bootstrap.
253252
///
254-
/// Only works for stage 0.
253+
/// These tools are intended to be only executed on the host system that
254+
/// invokes bootstrap, and they thus cannot be cross-compiled.
255+
///
256+
/// They are always built using the stage0 compiler, and typically they
257+
/// can be compiled with stable Rust.
258+
///
259+
/// These tools also essentially do not participate in staging.
255260
ToolBootstrap,
256261

257262
/// Build a tool which uses the locally built std, placing output in the
@@ -804,7 +809,9 @@ impl Build {
804809
Mode::Std => "-std",
805810
Mode::Rustc => "-rustc",
806811
Mode::Codegen => "-codegen",
807-
Mode::ToolBootstrap => "-bootstrap-tools",
812+
Mode::ToolBootstrap => {
813+
return self.out.join(compiler.host).join("bootstrap-tools");
814+
}
808815
Mode::ToolStd | Mode::ToolRustc => "-tools",
809816
};
810817
self.out.join(compiler.host).join(format!("stage{}{}", compiler.stage, suffix))

src/doc/rustc-dev-guide/src/building/bootstrapping/writing-tools-in-bootstrap.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ There are three types of tools you can write in bootstrap:
44

55
- **`Mode::ToolBootstrap`**
66
Use this for tools that don’t need anything from the in-tree compiler and can run with the stage0 `rustc`.
7-
The output is placed in the "stage0-bootstrap-tools" directory. This mode is for general-purpose tools built
7+
The output is placed in the "bootstrap-tools" directory. This mode is for general-purpose tools built
88
entirely with the stage0 compiler, including target libraries and only works for stage 0.
99

1010
- **`Mode::ToolStd`**

src/tools/compiletest/src/runtest/run_make.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ impl TestCx<'_> {
1212
// For `run-make` V2, we need to perform 2 steps to build and run a `run-make` V2 recipe
1313
// (`rmake.rs`) to run the actual tests. The support library is already built as a tool rust
1414
// library and is available under
15-
// `build/$HOST/stage0-bootstrap-tools/$TARGET/release/librun_make_support.rlib`.
15+
// `build/$HOST/bootstrap-tools/$TARGET/release/librun_make_support.rlib`.
1616
//
1717
// 1. We need to build the recipe `rmake.rs` as a binary and link in the `run_make_support`
1818
// library.
@@ -63,7 +63,7 @@ impl TestCx<'_> {
6363
//
6464
// ```
6565
// build/<target_triple>/
66-
// ├── stage0-bootstrap-tools/
66+
// ├── bootstrap-tools/
6767
// │ ├── <host_triple>/release/librun_make_support.rlib // <- support rlib itself
6868
// │ ├── <host_triple>/release/deps/ // <- deps
6969
// │ └── release/deps/ // <- deps of deps
@@ -72,7 +72,7 @@ impl TestCx<'_> {
7272
// FIXME(jieyouxu): there almost certainly is a better way to do this (specifically how the
7373
// support lib and its deps are organized), but this seems to work for now.
7474

75-
let tools_bin = host_build_root.join("stage0-bootstrap-tools");
75+
let tools_bin = host_build_root.join("bootstrap-tools");
7676
let support_host_path = tools_bin.join(&self.config.host).join("release");
7777
let support_lib_path = support_host_path.join("librun_make_support.rlib");
7878

0 commit comments

Comments
 (0)