From 92f5e58ccc514dbcaebecc1f6a4acb17b414389b Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Fri, 7 Jun 2019 09:39:28 -0600 Subject: [PATCH 1/5] Delete Rustbook step There's no need to have it given it merely forwarded to RustbookSrc. --- src/bootstrap/doc.rs | 46 ++++++++++++-------------------------------- 1 file changed, 12 insertions(+), 34 deletions(-) diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index 278ae8a9addcc..9d8e0d5eb6f0b 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -46,10 +46,11 @@ macro_rules! book { } fn run(self, builder: &Builder<'_>) { - builder.ensure(Rustbook { + builder.ensure(RustbookSrc { target: self.target, name: INTERNER.intern_str($book_name), version: $book_ver, + src: doc_src(builder), }) } } @@ -75,35 +76,8 @@ enum RustbookVersion { MdBook2, } -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -struct Rustbook { - target: Interned, - name: Interned, - version: RustbookVersion, -} - -impl Step for Rustbook { - type Output = (); - - // rustbook is never directly called, and only serves as a shim for the nomicon and the - // reference. - fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { - run.never() - } - - /// Invoke `rustbook` for `target` for the doc book `name`. - /// - /// This will not actually generate any documentation if the documentation has - /// already been generated. - fn run(self, builder: &Builder<'_>) { - let src = builder.src.join("src/doc"); - builder.ensure(RustbookSrc { - target: self.target, - name: self.name, - src: INTERNER.intern_path(src), - version: self.version, - }); - } +fn doc_src(builder: &Builder<'_>) -> Interned { + INTERNER.intern_path(builder.src.join("src/doc")) } #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] @@ -274,33 +248,37 @@ impl Step for TheBook { let name = self.name; // build book - builder.ensure(Rustbook { + builder.ensure(RustbookSrc { target, name: INTERNER.intern_string(name.to_string()), version: RustbookVersion::MdBook2, + src: doc_src(builder), }); // building older edition redirects let source_name = format!("{}/first-edition", name); - builder.ensure(Rustbook { + builder.ensure(RustbookSrc { target, name: INTERNER.intern_string(source_name), version: RustbookVersion::MdBook2, + src: doc_src(builder), }); let source_name = format!("{}/second-edition", name); - builder.ensure(Rustbook { + builder.ensure(RustbookSrc { target, name: INTERNER.intern_string(source_name), version: RustbookVersion::MdBook2, + src: doc_src(builder), }); let source_name = format!("{}/2018-edition", name); - builder.ensure(Rustbook { + builder.ensure(RustbookSrc { target, name: INTERNER.intern_string(source_name), version: RustbookVersion::MdBook2, + src: doc_src(builder), }); // build the version info page and CSS From 0e14818321bcb27f2c378c97958d175e8cf2f438 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Fri, 7 Jun 2019 11:10:27 -0600 Subject: [PATCH 2/5] Delete unnecessary command --- src/bootstrap/tool.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index 83a897f1ab74f..aec75df82c1eb 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -268,10 +268,6 @@ macro_rules! bootstrap_tool { } impl Tool { - pub fn get_mode(&self) -> Mode { - Mode::ToolBootstrap - } - /// Whether this tool requires LLVM to run pub fn uses_llvm_tools(&self) -> bool { match self { @@ -659,7 +655,7 @@ impl<'a> Builder<'a> { pub fn tool_cmd(&self, tool: Tool) -> Command { let mut cmd = Command::new(self.tool_exe(tool)); let compiler = self.compiler(0, self.config.build); - self.prepare_tool_cmd(compiler, tool, &mut cmd); + self.prepare_tool_cmd(compiler, &mut cmd); cmd } @@ -667,7 +663,7 @@ impl<'a> Builder<'a> { /// /// Notably this munges the dynamic library lookup path to point to the /// right location to run `compiler`. - fn prepare_tool_cmd(&self, compiler: Compiler, tool: Tool, cmd: &mut Command) { + fn prepare_tool_cmd(&self, compiler: Compiler, cmd: &mut Command) { let host = &compiler.host; let mut lib_paths: Vec = vec![ if compiler.stage == 0 { @@ -675,7 +671,7 @@ impl<'a> Builder<'a> { } else { PathBuf::from(&self.sysroot_libdir(compiler, compiler.host)) }, - self.cargo_out(compiler, tool.get_mode(), *host).join("deps"), + self.cargo_out(compiler, Mode::ToolBootstrap, *host).join("deps"), ]; // On MSVC a tool may invoke a C compiler (e.g., compiletest in run-make From 7234d8cb5ec57d5b27a9d3331107c402a4ed0fa8 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Fri, 7 Jun 2019 11:15:45 -0600 Subject: [PATCH 3/5] Inline prepare_tool_cmd Removing the tool argument in the previous commit means it's no longer restricted to just bootstrap tools despite being written as such. Inlining it prevents accidental use. --- src/bootstrap/tool.rs | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index aec75df82c1eb..bd77f7a91d94a 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -655,22 +655,13 @@ impl<'a> Builder<'a> { pub fn tool_cmd(&self, tool: Tool) -> Command { let mut cmd = Command::new(self.tool_exe(tool)); let compiler = self.compiler(0, self.config.build); - self.prepare_tool_cmd(compiler, &mut cmd); - cmd - } - - /// Prepares the `cmd` provided to be able to run the `compiler` provided. - /// - /// Notably this munges the dynamic library lookup path to point to the - /// right location to run `compiler`. - fn prepare_tool_cmd(&self, compiler: Compiler, cmd: &mut Command) { let host = &compiler.host; + // Prepares the `cmd` provided to be able to run the `compiler` provided. + // + // Notably this munges the dynamic library lookup path to point to the + // right location to run `compiler`. let mut lib_paths: Vec = vec![ - if compiler.stage == 0 { - self.build.rustc_snapshot_libdir() - } else { - PathBuf::from(&self.sysroot_libdir(compiler, compiler.host)) - }, + self.build.rustc_snapshot_libdir(), self.cargo_out(compiler, Mode::ToolBootstrap, *host).join("deps"), ]; @@ -692,6 +683,7 @@ impl<'a> Builder<'a> { } } - add_lib_path(lib_paths, cmd); + add_lib_path(lib_paths, &mut cmd); + cmd } } From 11543585c2ab9427f71fe2d5b3b0102672d54e12 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Fri, 7 Jun 2019 14:30:48 -0600 Subject: [PATCH 4/5] Delete unused fields on Crate struct --- src/bootstrap/lib.rs | 5 ----- src/bootstrap/metadata.rs | 6 ------ 2 files changed, 11 deletions(-) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index b9d287abb0c7e..7f652c0d7a776 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -270,14 +270,9 @@ pub struct Build { #[derive(Debug)] struct Crate { name: Interned, - version: String, deps: HashSet>, id: String, path: PathBuf, - doc_step: String, - build_step: String, - test_step: String, - bench_step: String, } impl Crate { diff --git a/src/bootstrap/metadata.rs b/src/bootstrap/metadata.rs index 4a71fd2ce0bd2..b622b3682a777 100644 --- a/src/bootstrap/metadata.rs +++ b/src/bootstrap/metadata.rs @@ -20,7 +20,6 @@ struct Output { struct Package { id: String, name: String, - version: String, source: Option, manifest_path: String, } @@ -84,12 +83,7 @@ fn build_krate(features: &str, build: &mut Build, resolves: &mut Vec Date: Fri, 7 Jun 2019 10:05:42 -0600 Subject: [PATCH 5/5] Remove unnecessary Std dependency --- src/bootstrap/builder.rs | 4 ---- src/bootstrap/doc.rs | 5 ----- 2 files changed, 9 deletions(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index cd0a93b01150c..61e53f53e9797 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -1693,10 +1693,6 @@ mod __test { compiler: Compiler { host: a, stage: 1 }, target: b, }, - compile::Std { - compiler: Compiler { host: a, stage: 2 }, - target: b, - }, ] ); assert_eq!( diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index 9d8e0d5eb6f0b..eac46c144242d 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -876,11 +876,6 @@ impl Step for UnstableBookGen { fn run(self, builder: &Builder<'_>) { let target = self.target; - builder.ensure(compile::Std { - compiler: builder.compiler(builder.top_stage, builder.config.build), - target, - }); - builder.info(&format!("Generating unstable book md files ({})", target)); let out = builder.md_doc_out(target).join("unstable-book"); builder.create_dir(&out);