about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/bootstrap/builder.rs19
-rw-r--r--src/bootstrap/clean.rs22
-rw-r--r--src/bootstrap/compile.rs15
3 files changed, 40 insertions, 16 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 707e4169002..97b353b5462 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -109,6 +109,25 @@ impl RunConfig<'_> {
     }
 }
 
+/// A description of the crates in this set, suitable for passing to `builder.info`.
+///
+/// `crates` should be generated by [`RunConfig::cargo_crates_in_set`].
+pub fn crate_description(crates: Interned<Vec<String>>) -> String {
+    if crates.is_empty() {
+        return "".into();
+    }
+
+    let mut descr = String::from(": {");
+    for krate in &*crates {
+        write!(descr, "{}, ", krate.strip_prefix("-p=").unwrap()).unwrap();
+    }
+
+    descr.pop();
+    descr.pop();
+    descr.push('}');
+    descr
+}
+
 struct StepDescription {
     default: bool,
     only_hosts: bool,
diff --git a/src/bootstrap/clean.rs b/src/bootstrap/clean.rs
index 8e363ee1290..d887495d633 100644
--- a/src/bootstrap/clean.rs
+++ b/src/bootstrap/clean.rs
@@ -9,11 +9,10 @@ use std::fs;
 use std::io::{self, ErrorKind};
 use std::path::Path;
 
-use crate::builder::{Builder, RunConfig, ShouldRun, Step};
+use crate::builder::{crate_description, Builder, RunConfig, ShouldRun, Step};
 use crate::cache::Interned;
-use crate::config::TargetSelection;
 use crate::util::t;
-use crate::{Build, Mode, Subcommand};
+use crate::{Build, Compiler, Mode, Subcommand};
 
 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
 pub struct CleanAll {}
@@ -40,7 +39,7 @@ macro_rules! clean_crate_tree {
     ( $( $name:ident, $mode:path, $root_crate:literal);+ $(;)? ) => { $(
         #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
         pub struct $name {
-            target: TargetSelection,
+            compiler: Compiler,
             crates: Interned<Vec<String>>,
         }
 
@@ -54,22 +53,21 @@ macro_rules! clean_crate_tree {
 
             fn make_run(run: RunConfig<'_>) {
                 let builder = run.builder;
-                if builder.top_stage != 0 {
-                    panic!("non-stage-0 clean not supported for individual crates");
-                }
-                builder.ensure(Self { crates: run.cargo_crates_in_set(), target: run.target });
+                let compiler = builder.compiler(builder.top_stage, run.target);
+                builder.ensure(Self { crates: run.cargo_crates_in_set(), compiler });
             }
 
             fn run(self, builder: &Builder<'_>) -> Self::Output {
-                let compiler = builder.compiler(0, self.target);
-                let mut cargo = builder.bare_cargo(compiler, $mode, self.target, "clean");
+                let compiler = self.compiler;
+                let target = compiler.host;
+                let mut cargo = builder.bare_cargo(compiler, $mode, target, "clean");
                 for krate in &*self.crates {
                     cargo.arg(krate);
                 }
 
                 builder.info(&format!(
-                    "Cleaning stage{} {} artifacts ({} -> {})",
-                    compiler.stage, stringify!($name).to_lowercase(), &compiler.host, self.target
+                    "Cleaning stage{} {} artifacts ({} -> {}){}",
+                    compiler.stage, stringify!($name).to_lowercase(), &compiler.host, target, crate_description(self.crates),
                 ));
 
                 // NOTE: doesn't use `run_cargo` because we don't want to save a stamp file,
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index 1030247b890..5bf5683f85d 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -18,6 +18,7 @@ use std::str;
 
 use serde::Deserialize;
 
+use crate::builder::crate_description;
 use crate::builder::Cargo;
 use crate::builder::{Builder, Kind, RunConfig, ShouldRun, Step};
 use crate::cache::{Interned, INTERNER};
@@ -128,8 +129,11 @@ impl Step for Std {
         std_cargo(builder, target, compiler.stage, &mut cargo);
 
         builder.info(&format!(
-            "Building stage{} std artifacts ({} -> {})",
-            compiler.stage, &compiler.host, target
+            "Building stage{} std artifacts ({} -> {}){}",
+            compiler.stage,
+            &compiler.host,
+            target,
+            crate_description(self.crates),
         ));
         run_cargo(
             builder,
@@ -715,8 +719,11 @@ impl Step for Rustc {
         }
 
         builder.info(&format!(
-            "Building stage{} compiler artifacts ({} -> {})",
-            compiler.stage, &compiler.host, target
+            "Building stage{} compiler artifacts ({} -> {}){}",
+            compiler.stage,
+            &compiler.host,
+            target,
+            crate_description(self.crates),
         ));
         run_cargo(
             builder,