]> git.lizzy.rs Git - rust.git/blobdiff - src/bootstrap/compile.rs
Support `x clean --stage 1 rustc_query_impl`
[rust.git] / src / bootstrap / compile.rs
index 0e3bbad9909eb243c7a02618bc6d0332db49c07c..5bf5683f85deac0d7faa0903c1b3ed139d0cc572 100644 (file)
@@ -18,6 +18,7 @@
 
 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};
@@ -46,17 +47,6 @@ pub fn new(compiler: Compiler, target: TargetSelection) -> Self {
     }
 }
 
-/// Return a `-p=x -p=y` string suitable for passing to a cargo invocation.
-fn build_crates_in_set(run: &RunConfig<'_>) -> Interned<Vec<String>> {
-    let mut crates = Vec::new();
-    for krate in &run.paths {
-        let path = krate.assert_single_path();
-        let crate_name = run.builder.crate_paths[&path.path];
-        crates.push(format!("-p={crate_name}"));
-    }
-    INTERNER.intern_list(crates)
-}
-
 impl Step for Std {
     type Output = ();
     const DEFAULT: bool = true;
@@ -76,7 +66,7 @@ fn make_run(run: RunConfig<'_>) {
         // Build all crates anyway, as if they hadn't passed the other args.
         let has_library =
             run.paths.iter().any(|set| set.assert_single_path().path.ends_with("library"));
-        let crates = if has_library { Default::default() } else { build_crates_in_set(&run) };
+        let crates = if has_library { Default::default() } else { run.cargo_crates_in_set() };
         run.builder.ensure(Std {
             compiler: run.builder.compiler(run.builder.top_stage, run.build_triple()),
             target: run.target,
@@ -139,8 +129,11 @@ fn run(self, builder: &Builder<'_>) {
         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,
@@ -603,7 +596,7 @@ fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
     }
 
     fn make_run(run: RunConfig<'_>) {
-        let crates = build_crates_in_set(&run);
+        let crates = run.cargo_crates_in_set();
         run.builder.ensure(Rustc {
             compiler: run.builder.compiler(run.builder.top_stage, run.build_triple()),
             target: run.target,
@@ -702,7 +695,8 @@ fn run(self, builder: &Builder<'_>) {
             ));
         }
 
-        // cfg(bootstrap): remove if condition once the bootstrap compiler supports dylib LTO
+        // We currently don't support cross-crate LTO in stage0. This also isn't hugely necessary
+        // and may just be a time sink.
         if compiler.stage != 0 {
             match builder.config.rust_lto {
                 RustcLto::Thin | RustcLto::Fat => {
@@ -725,8 +719,11 @@ fn run(self, builder: &Builder<'_>) {
         }
 
         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,