Skip to content

Commit d3abd6c

Browse files
authored
Rollup merge of rust-lang#61639 - Mark-Simulacrum:bootstrap-cleanup, r=alexcrichton
Bootstrap cleanup Each commit is (mostly) standalone and probably best reviewed as such. Nothing too major just some drive-by nits as I was looking through the code. r? @alexcrichton
2 parents c6c9f66 + e4c44c7 commit d3abd6c

File tree

5 files changed

+21
-108
lines changed

5 files changed

+21
-108
lines changed

src/bootstrap/builder.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1693,10 +1693,6 @@ mod __test {
16931693
compiler: Compiler { host: a, stage: 1 },
16941694
target: b,
16951695
},
1696-
compile::Std {
1697-
compiler: Compiler { host: a, stage: 2 },
1698-
target: b,
1699-
},
17001696
]
17011697
);
17021698
assert_eq!(

src/bootstrap/doc.rs

+12-39
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ macro_rules! book {
4646
}
4747

4848
fn run(self, builder: &Builder<'_>) {
49-
builder.ensure(Rustbook {
49+
builder.ensure(RustbookSrc {
5050
target: self.target,
5151
name: INTERNER.intern_str($book_name),
5252
version: $book_ver,
53+
src: doc_src(builder),
5354
})
5455
}
5556
}
@@ -75,35 +76,8 @@ enum RustbookVersion {
7576
MdBook2,
7677
}
7778

78-
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
79-
struct Rustbook {
80-
target: Interned<String>,
81-
name: Interned<String>,
82-
version: RustbookVersion,
83-
}
84-
85-
impl Step for Rustbook {
86-
type Output = ();
87-
88-
// rustbook is never directly called, and only serves as a shim for the nomicon and the
89-
// reference.
90-
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
91-
run.never()
92-
}
93-
94-
/// Invoke `rustbook` for `target` for the doc book `name`.
95-
///
96-
/// This will not actually generate any documentation if the documentation has
97-
/// already been generated.
98-
fn run(self, builder: &Builder<'_>) {
99-
let src = builder.src.join("src/doc");
100-
builder.ensure(RustbookSrc {
101-
target: self.target,
102-
name: self.name,
103-
src: INTERNER.intern_path(src),
104-
version: self.version,
105-
});
106-
}
79+
fn doc_src(builder: &Builder<'_>) -> Interned<PathBuf> {
80+
INTERNER.intern_path(builder.src.join("src/doc"))
10781
}
10882

10983
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
@@ -274,33 +248,37 @@ impl Step for TheBook {
274248
let name = self.name;
275249

276250
// build book
277-
builder.ensure(Rustbook {
251+
builder.ensure(RustbookSrc {
278252
target,
279253
name: INTERNER.intern_string(name.to_string()),
280254
version: RustbookVersion::MdBook2,
255+
src: doc_src(builder),
281256
});
282257

283258
// building older edition redirects
284259

285260
let source_name = format!("{}/first-edition", name);
286-
builder.ensure(Rustbook {
261+
builder.ensure(RustbookSrc {
287262
target,
288263
name: INTERNER.intern_string(source_name),
289264
version: RustbookVersion::MdBook2,
265+
src: doc_src(builder),
290266
});
291267

292268
let source_name = format!("{}/second-edition", name);
293-
builder.ensure(Rustbook {
269+
builder.ensure(RustbookSrc {
294270
target,
295271
name: INTERNER.intern_string(source_name),
296272
version: RustbookVersion::MdBook2,
273+
src: doc_src(builder),
297274
});
298275

299276
let source_name = format!("{}/2018-edition", name);
300-
builder.ensure(Rustbook {
277+
builder.ensure(RustbookSrc {
301278
target,
302279
name: INTERNER.intern_string(source_name),
303280
version: RustbookVersion::MdBook2,
281+
src: doc_src(builder),
304282
});
305283

306284
// build the version info page and CSS
@@ -898,11 +876,6 @@ impl Step for UnstableBookGen {
898876
fn run(self, builder: &Builder<'_>) {
899877
let target = self.target;
900878

901-
builder.ensure(compile::Std {
902-
compiler: builder.compiler(builder.top_stage, builder.config.build),
903-
target,
904-
});
905-
906879
builder.info(&format!("Generating unstable book md files ({})", target));
907880
let out = builder.md_doc_out(target).join("unstable-book");
908881
builder.create_dir(&out);

src/bootstrap/lib.rs

-5
Original file line numberDiff line numberDiff line change
@@ -270,14 +270,9 @@ pub struct Build {
270270
#[derive(Debug)]
271271
struct Crate {
272272
name: Interned<String>,
273-
version: String,
274273
deps: HashSet<Interned<String>>,
275274
id: String,
276275
path: PathBuf,
277-
doc_step: String,
278-
build_step: String,
279-
test_step: String,
280-
bench_step: String,
281276
}
282277

283278
impl Crate {

src/bootstrap/metadata.rs

-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ struct Output {
2020
struct Package {
2121
id: String,
2222
name: String,
23-
version: String,
2423
source: Option<String>,
2524
manifest_path: String,
2625
}
@@ -84,12 +83,7 @@ fn build_krate(features: &str, build: &mut Build, resolves: &mut Vec<ResolveNode
8483
let mut path = PathBuf::from(package.manifest_path);
8584
path.pop();
8685
build.crates.insert(name, Crate {
87-
build_step: format!("build-crate-{}", name),
88-
doc_step: format!("doc-crate-{}", name),
89-
test_step: format!("test-crate-{}", name),
90-
bench_step: format!("bench-crate-{}", name),
9186
name,
92-
version: package.version,
9387
id: package.id,
9488
deps: HashSet::new(),
9589
path,

src/bootstrap/tool.rs

+9-54
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,6 @@ macro_rules! bootstrap_tool {
268268
}
269269

270270
impl Tool {
271-
pub fn get_mode(&self) -> Mode {
272-
Mode::ToolBootstrap
273-
}
274-
275271
/// Whether this tool requires LLVM to run
276272
pub fn uses_llvm_tools(&self) -> bool {
277273
match self {
@@ -345,6 +341,7 @@ bootstrap_tool!(
345341
Compiletest, "src/tools/compiletest", "compiletest", llvm_tools = true;
346342
BuildManifest, "src/tools/build-manifest", "build-manifest";
347343
RemoteTestClient, "src/tools/remote-test-client", "remote-test-client";
344+
RemoteTestServer, "src/tools/remote-test-server", "remote-test-server";
348345
RustInstaller, "src/tools/rust-installer", "fabricate", is_external_tool = true;
349346
RustdocTheme, "src/tools/rustdoc-themes", "rustdoc-themes";
350347
);
@@ -397,40 +394,6 @@ impl Step for ErrorIndex {
397394
}
398395
}
399396

400-
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
401-
pub struct RemoteTestServer {
402-
pub compiler: Compiler,
403-
pub target: Interned<String>,
404-
}
405-
406-
impl Step for RemoteTestServer {
407-
type Output = PathBuf;
408-
409-
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
410-
run.path("src/tools/remote-test-server")
411-
}
412-
413-
fn make_run(run: RunConfig<'_>) {
414-
run.builder.ensure(RemoteTestServer {
415-
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
416-
target: run.target,
417-
});
418-
}
419-
420-
fn run(self, builder: &Builder<'_>) -> PathBuf {
421-
builder.ensure(ToolBuild {
422-
compiler: self.compiler,
423-
target: self.target,
424-
tool: "remote-test-server",
425-
mode: Mode::ToolStd,
426-
path: "src/tools/remote-test-server",
427-
is_optional_tool: false,
428-
source_type: SourceType::InTree,
429-
extra_features: Vec::new(),
430-
}).expect("expected to build -- essential tool")
431-
}
432-
}
433-
434397
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
435398
pub struct Rustdoc {
436399
/// This should only ever be 0 or 2.
@@ -659,23 +622,14 @@ impl<'a> Builder<'a> {
659622
pub fn tool_cmd(&self, tool: Tool) -> Command {
660623
let mut cmd = Command::new(self.tool_exe(tool));
661624
let compiler = self.compiler(0, self.config.build);
662-
self.prepare_tool_cmd(compiler, tool, &mut cmd);
663-
cmd
664-
}
665-
666-
/// Prepares the `cmd` provided to be able to run the `compiler` provided.
667-
///
668-
/// Notably this munges the dynamic library lookup path to point to the
669-
/// right location to run `compiler`.
670-
fn prepare_tool_cmd(&self, compiler: Compiler, tool: Tool, cmd: &mut Command) {
671625
let host = &compiler.host;
626+
// Prepares the `cmd` provided to be able to run the `compiler` provided.
627+
//
628+
// Notably this munges the dynamic library lookup path to point to the
629+
// right location to run `compiler`.
672630
let mut lib_paths: Vec<PathBuf> = vec![
673-
if compiler.stage == 0 {
674-
self.build.rustc_snapshot_libdir()
675-
} else {
676-
PathBuf::from(&self.sysroot_libdir(compiler, compiler.host))
677-
},
678-
self.cargo_out(compiler, tool.get_mode(), *host).join("deps"),
631+
self.build.rustc_snapshot_libdir(),
632+
self.cargo_out(compiler, Mode::ToolBootstrap, *host).join("deps"),
679633
];
680634

681635
// On MSVC a tool may invoke a C compiler (e.g., compiletest in run-make
@@ -696,6 +650,7 @@ impl<'a> Builder<'a> {
696650
}
697651
}
698652

699-
add_lib_path(lib_paths, cmd);
653+
add_lib_path(lib_paths, &mut cmd);
654+
cmd
700655
}
701656
}

0 commit comments

Comments
 (0)