Skip to content

Commit a6620a4

Browse files
committed
Auto merge of rust-lang#145011 - Kobzol:bootstrap-doc, r=jieyouxu
Enforce in bootstrap that doc must have stage at least 1 Following with the bootstrap cleanups, this time around `doc` steps. Should be pretty straightforward, because the supporting infrastructure was already there. The only thing I found a bit fishy is using `Mode::ToolBootstrap` as a "catch-all" mode for non-rustc-private steps in `tool_doc!`, but I don't think that we need to distinguish the tools in some special way when documenting them, apart from supporting `rustc_private`. Before, `x doc` more or less defaulted to what we call stage 2 now. Now it is properly stage 1, so e.g. `x doc compiler` documents the compiler using the stage0/beta rust(do)c. r? `@jieyouxu` try-job: dist-aarch64-msvc
2 parents 53af067 + 8b4d941 commit a6620a4

File tree

8 files changed

+514
-243
lines changed

8 files changed

+514
-243
lines changed

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

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ impl Step for Docs {
9292

9393
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
9494
pub struct JsonDocs {
95-
pub host: TargetSelection,
95+
build_compiler: Compiler,
96+
target: TargetSelection,
9697
}
9798

9899
impl Step for JsonDocs {
@@ -105,24 +106,27 @@ impl Step for JsonDocs {
105106
}
106107

107108
fn make_run(run: RunConfig<'_>) {
108-
run.builder.ensure(JsonDocs { host: run.target });
109+
run.builder.ensure(JsonDocs {
110+
build_compiler: run.builder.compiler(run.builder.top_stage, run.builder.host_target),
111+
target: run.target,
112+
});
109113
}
110114

111115
/// Builds the `rust-docs-json` installer component.
112116
fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
113-
let host = self.host;
114-
builder.ensure(crate::core::build_steps::doc::Std::new(
115-
builder.top_stage,
116-
host,
117+
let target = self.target;
118+
let directory = builder.ensure(crate::core::build_steps::doc::Std::from_build_compiler(
119+
self.build_compiler,
120+
target,
117121
DocumentationFormat::Json,
118122
));
119123

120124
let dest = "share/doc/rust/json";
121125

122-
let mut tarball = Tarball::new(builder, "rust-docs-json", &host.triple);
126+
let mut tarball = Tarball::new(builder, "rust-docs-json", &target.triple);
123127
tarball.set_product_name("Rust Documentation In JSON Format");
124128
tarball.is_preview(true);
125-
tarball.add_bulk_dir(builder.json_doc_out(host), dest);
129+
tarball.add_bulk_dir(directory, dest);
126130
Some(tarball.generate())
127131
}
128132
}
@@ -1585,19 +1589,21 @@ impl Step for Extended {
15851589
};
15861590
}
15871591

1592+
let target_compiler = builder.compiler(stage, target);
15881593
// When rust-std package split from rustc, we needed to ensure that during
15891594
// upgrades rustc was upgraded before rust-std. To avoid rustc clobbering
15901595
// the std files during uninstall. To do this ensure that rustc comes
15911596
// before rust-std in the list below.
1592-
tarballs.push(builder.ensure(Rustc { compiler: builder.compiler(stage, target) }));
1597+
tarballs.push(builder.ensure(Rustc { compiler: target_compiler }));
15931598
tarballs.push(builder.ensure(Std { compiler, target }).expect("missing std"));
15941599

15951600
if target.is_windows_gnu() {
15961601
tarballs.push(builder.ensure(Mingw { host: target }).expect("missing mingw"));
15971602
}
15981603

15991604
add_component!("rust-docs" => Docs { host: target });
1600-
add_component!("rust-json-docs" => JsonDocs { host: target });
1605+
// Std stage N is documented with compiler stage N
1606+
add_component!("rust-json-docs" => JsonDocs { build_compiler: target_compiler, target });
16011607
add_component!("cargo" => Cargo { build_compiler: compiler, target });
16021608
add_component!("rustfmt" => Rustfmt { build_compiler: compiler, target });
16031609
add_component!("rust-analyzer" => RustAnalyzer { build_compiler: compiler, target });

0 commit comments

Comments
 (0)