about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-03-01 20:52:47 +0000
committerbors <bors@rust-lang.org>2021-03-01 20:52:47 +0000
commit4f20caa6258d4c74ce6b316fd347e3efe81cf557 (patch)
treeb02c6087e615f61520af2c778e4d366ff9bfa7d7 /src/bootstrap
parentccad218e7f909d7dabdb901437fffc151873b8a1 (diff)
parent9a86a727c5acdf51a3cf062db552a2391da99276 (diff)
downloadrust-4f20caa6258d4c74ce6b316fd347e3efe81cf557.tar.gz
rust-4f20caa6258d4c74ce6b316fd347e3efe81cf557.zip
Auto merge of #82663 - jyn514:rollup-xh3cb0c, r=jyn514
Rollup of 8 pull requests

Successful merges:

 - #81210 (BTreeMap: correct node size test case for choices of B)
 - #82360 (config.toml parsing error improvements)
 - #82428 (Update mdbook)
 - #82480 (Remove `ENABLE_DOWNLOAD_RUSTC` constant)
 - #82578 (Add some diagnostic items for Clippy)
 - #82620 (Apply lint restrictions from renamed lints)
 - #82635 (Fix typos in rustc_infer::infer::nll_relate)
 - #82645 (Clarify that SyncOnceCell::set blocks.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/builder.rs18
-rw-r--r--src/bootstrap/check.rs4
-rw-r--r--src/bootstrap/compile.rs24
-rw-r--r--src/bootstrap/tool.rs1
4 files changed, 22 insertions, 25 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 4a7c1850dd3..2008348ea8d 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -57,14 +57,6 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash {
     /// `true` here can still be overwritten by `should_run` calling `default_condition`.
     const DEFAULT: bool = false;
 
-    /// Whether this step should be run even when `download-rustc` is set.
-    ///
-    /// Most steps are not important when the compiler is downloaded, since they will be included in
-    /// the pre-compiled sysroot. Steps can set this to `true` to be built anyway.
-    ///
-    /// When in doubt, set this to `false`.
-    const ENABLE_DOWNLOAD_RUSTC: bool = false;
-
     /// If true, then this rule should be skipped if --target was specified, but --host was not
     const ONLY_HOSTS: bool = false;
 
@@ -107,7 +99,6 @@ impl RunConfig<'_> {
 
 struct StepDescription {
     default: bool,
-    enable_download_rustc: bool,
     only_hosts: bool,
     should_run: fn(ShouldRun<'_>) -> ShouldRun<'_>,
     make_run: fn(RunConfig<'_>),
@@ -162,7 +153,6 @@ impl StepDescription {
     fn from<S: Step>() -> StepDescription {
         StepDescription {
             default: S::DEFAULT,
-            enable_download_rustc: S::ENABLE_DOWNLOAD_RUSTC,
             only_hosts: S::ONLY_HOSTS,
             should_run: S::should_run,
             make_run: S::make_run,
@@ -179,14 +169,6 @@ impl StepDescription {
                 "{:?} not skipped for {:?} -- not in {:?}",
                 pathset, self.name, builder.config.exclude
             );
-        } else if builder.config.download_rustc && !self.enable_download_rustc {
-            if !builder.config.dry_run {
-                eprintln!(
-                    "Not running {} because its artifacts have been downloaded from CI (`download-rustc` is set)",
-                    self.name
-                );
-            }
-            return;
         }
 
         // Determine the targets participating in this rule.
diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs
index 9b80f1cf9fc..6626fead774 100644
--- a/src/bootstrap/check.rs
+++ b/src/bootstrap/check.rs
@@ -62,7 +62,6 @@ fn cargo_subcommand(kind: Kind) -> &'static str {
 impl Step for Std {
     type Output = ();
     const DEFAULT: bool = true;
-    const ENABLE_DOWNLOAD_RUSTC: bool = true;
 
     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
         run.all_krates("test")
@@ -156,7 +155,6 @@ impl Step for Rustc {
     type Output = ();
     const ONLY_HOSTS: bool = true;
     const DEFAULT: bool = true;
-    const ENABLE_DOWNLOAD_RUSTC: bool = true;
 
     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
         run.all_krates("rustc-main")
@@ -235,7 +233,6 @@ impl Step for CodegenBackend {
     type Output = ();
     const ONLY_HOSTS: bool = true;
     const DEFAULT: bool = true;
-    const ENABLE_DOWNLOAD_RUSTC: bool = true;
 
     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
         run.paths(&["compiler/rustc_codegen_cranelift", "rustc_codegen_cranelift"])
@@ -293,7 +290,6 @@ macro_rules! tool_check_step {
             type Output = ();
             const ONLY_HOSTS: bool = true;
             const DEFAULT: bool = true;
-            const ENABLE_DOWNLOAD_RUSTC: bool = true;
 
             fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
                 run.path($path)
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index 859e38dc346..24800b7886d 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -63,6 +63,12 @@ impl Step for Std {
         let target = self.target;
         let compiler = self.compiler;
 
+        // These artifacts were already copied (in `impl Step for Sysroot`).
+        // Don't recompile them.
+        if builder.config.download_rustc {
+            return;
+        }
+
         if builder.config.keep_stage.contains(&compiler.stage)
             || builder.config.keep_stage_std.contains(&compiler.stage)
         {
@@ -178,7 +184,9 @@ fn copy_self_contained_objects(
     // To do that we have to distribute musl startup objects as a part of Rust toolchain
     // and link with them manually in the self-contained mode.
     if target.contains("musl") {
-        let srcdir = builder.musl_libdir(target).unwrap();
+        let srcdir = builder.musl_libdir(target).unwrap_or_else(|| {
+            panic!("Target {:?} does not have a \"musl-libdir\" key", target.triple)
+        });
         for &obj in &["crt1.o", "Scrt1.o", "rcrt1.o", "crti.o", "crtn.o"] {
             copy_and_stamp(
                 builder,
@@ -196,7 +204,12 @@ fn copy_self_contained_objects(
             target_deps.push((target, DependencyType::TargetSelfContained));
         }
     } else if target.ends_with("-wasi") {
-        let srcdir = builder.wasi_root(target).unwrap().join("lib/wasm32-wasi");
+        let srcdir = builder
+            .wasi_root(target)
+            .unwrap_or_else(|| {
+                panic!("Target {:?} does not have a \"wasi-root\" key", target.triple)
+            })
+            .join("lib/wasm32-wasi");
         for &obj in &["crt1.o", "crt1-reactor.o"] {
             copy_and_stamp(
                 builder,
@@ -500,6 +513,13 @@ impl Step for Rustc {
         let compiler = self.compiler;
         let target = self.target;
 
+        if builder.config.download_rustc {
+            // Copy the existing artifacts instead of rebuilding them.
+            // NOTE: this path is only taken for tools linking to rustc-dev.
+            builder.ensure(Sysroot { compiler });
+            return;
+        }
+
         builder.ensure(Std { compiler, target });
 
         if builder.config.keep_stage.contains(&compiler.stage) {
diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index 71aa6bb150e..3fc3b68fd86 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -483,7 +483,6 @@ pub struct Rustdoc {
 impl Step for Rustdoc {
     type Output = PathBuf;
     const DEFAULT: bool = true;
-    const ENABLE_DOWNLOAD_RUSTC: bool = true;
     const ONLY_HOSTS: bool = true;
 
     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {