diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 56ecc6e68a98c..88c6501c858be 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -1,9 +1,10 @@ use std::any::Any; +use std::borrow::Cow; use std::cell::{Cell, RefCell}; use std::collections::BTreeSet; use std::env; use std::ffi::OsStr; -use std::fmt::Debug; +use std::fmt::{self, Debug, Display}; use std::fs; use std::hash::Hash; use std::ops::Deref; @@ -50,7 +51,7 @@ impl<'a> Deref for Builder<'a> { } } -pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash { +pub(crate) trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash { /// `PathBuf` when directories are created or to return a `Compiler` once /// it's been assembled. type Output: Clone; @@ -62,6 +63,13 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash { /// If true, then this rule should be skipped if --target was specified, but --host was not const ONLY_HOSTS: bool = false; + /// A user-visible name to display if this step fails. + fn name(&self) -> &'static str { + std::any::type_name::() + } + + fn info(_step_info: &mut StepInfo<'_, '_, Self>); + /// Primary function to execute this rule. Can call `builder.ensure()` /// with other steps to run those. fn run(self, builder: &Builder<'_>) -> Self::Output; @@ -351,6 +359,26 @@ pub enum Kind { Run, } +impl Display for Kind { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + use Kind::*; + let s = match self { + Build => "build", + Check => "check", + Clippy => "clippy", + Fix => "fix", + Format => "fmt", + Test => "test", + Bench => "bench", + Dist => "dist", + Doc => "doc", + Install => "install", + Run => "run", + }; + f.write_str(s) + } +} + impl<'a> Builder<'a> { fn get_step_descriptions(kind: Kind) -> Vec { macro_rules! describe { @@ -610,6 +638,12 @@ impl<'a> Builder<'a> { StepDescription::run(v, self, paths); } + pub(crate) fn step_info(&self, step: &impl Step) { + let mut info = StepInfo::new(self, step); + Step::info(&mut info); + info.print(); + } + /// Obtain a compiler at a given stage and for a given host. Explicitly does /// not take `Compiler` since all `Compiler` instances are meant to be /// obtained through this function, since it ensures that they are valid @@ -661,6 +695,11 @@ impl<'a> Builder<'a> { run.never() } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.compiler(&step.compiler).target(step.target).cmd(Kind::Check); + } + fn run(self, builder: &Builder<'_>) -> Interned { let lib = builder.sysroot_libdir_relative(self.compiler); let sysroot = builder @@ -1532,7 +1571,7 @@ impl<'a> Builder<'a> { /// Ensure that a given step is built, returning its output. This will /// cache the step, so it is safe (and good!) to call this as often as /// needed to ensure that all dependencies are built. - pub fn ensure(&'a self, step: S) -> S::Output { + pub(crate) fn ensure(&'a self, step: S) -> S::Output { { let mut stack = self.stack.borrow_mut(); for stack_step in stack.iter() { @@ -1563,6 +1602,7 @@ impl<'a> Builder<'a> { let out = step.clone().run(self); let dur = start.elapsed(); let deps = self.time_spent_on_dependencies.replace(parent + dur); + (out, dur - deps) }; @@ -1692,3 +1732,131 @@ impl From for Command { cargo.command } } + +pub(crate) struct StepInfo<'a, 'b, S> { + pub(crate) builder: &'a Builder<'b>, + pub(crate) step: &'a S, + compiler: Option>, + stage: Option, + host: Option, + target: Option, + cmd: Option, + path: Option, +} + +impl<'a> From for Cow<'a, Compiler> { + fn from(val: Compiler) -> Self { + Self::Owned(val) + } +} + +impl<'a> From<&'a Compiler> for Cow<'a, Compiler> { + fn from(val: &'a Compiler) -> Self { + Self::Borrowed(val) + } +} + +impl<'a, 'b, S> StepInfo<'a, 'b, S> { + pub(crate) fn new(builder: &'a Builder<'b>, step: &'a S) -> Self { + Self { + builder, + step, + compiler: None, + stage: None, + host: None, + target: None, + cmd: None, + path: None, + } + } + + pub(crate) fn compiler(&mut self, val: impl Into>) -> &mut Self { + if self.compiler.is_some() { + panic!("cannot overwrite compiler"); + } + let val = val.into(); + self.stage(val.stage).host(val.host); + self.compiler = Some(val); + self + } + + pub(crate) fn stage(&mut self, stage: u32) -> &mut Self { + if self.stage.is_some() { + panic!("cannot overwrite stage"); + } + self.stage = Some(stage); + self + } + + pub(crate) fn host(&mut self, host: TargetSelection) -> &mut Self { + if self.host.is_some() { + panic!("cannot overwrite host"); + } + self.host = Some(host); + self + } + + pub(crate) fn target(&mut self, target: TargetSelection) -> &mut Self { + if self.target.is_some() { + panic!("cannot overwrite target"); + } + self.target = Some(target); + self + } + + pub(crate) fn cmd(&mut self, val: Kind) -> &mut Self { + if self.cmd.is_some() { + panic!("cannot overwrite cmd"); + } + self.cmd = Some(val); + self + } + + pub(crate) fn path(&mut self, val: PathBuf) -> &mut Self { + if self.path.is_some() { + panic!("cannot overwrite path"); + } + self.path = Some(val); + self + } + + /// Print a command that will run the current step. + /// + /// This serves two purposes: + /// 1. Describe what step is currently being run. + /// 2. Describe how to run only this step in case it fails. + pub(crate) fn print(&self) + where + S: Step, + { + let builder = self.builder; + if builder.config.dry_run { + return; + } + let stage = self.stage.unwrap_or(self.builder.top_stage); + let kind = self.cmd.unwrap_or_else(|| panic!("missing kind for {}", self.step.name())); + let path = self.path.clone().unwrap_or_else(|| { + let paths = S::should_run(ShouldRun::new(builder)).paths; + paths.iter().map(|pathset| pathset.path(builder)).next().expect("no paths for step") + }); + print!("{} {} --stage {}", kind, path.display(), stage,); + if let Some(host) = self.host { + // Almost always, this will be the same as build. Don't print it if so. + if host != builder.config.build { + print!(" --host {}", host); + } + } + if let Some(target) = self.target { + let different_from_host = self.host.map_or(false, |h| h != target); + if target != builder.config.build || different_from_host { + print!(" --target {}", target); + } + } + if kind == Kind::Test { + for arg in builder.config.cmd.test_args() { + print!(" --test-args \"{}\"", arg); + } + } + println!(); + } +} diff --git a/src/bootstrap/builder/tests.rs b/src/bootstrap/builder/tests.rs index e7fb8c0d4d5d2..c4d0d48a6d844 100644 --- a/src/bootstrap/builder/tests.rs +++ b/src/bootstrap/builder/tests.rs @@ -511,7 +511,8 @@ mod dist { target: host, mode: Mode::Std, test_kind: test::TestKind::Test, - krate: INTERNER.intern_str("std"), + krate_name: INTERNER.intern_str("std"), + krate_path: "library/std".into(), },] ); } diff --git a/src/bootstrap/cache.rs b/src/bootstrap/cache.rs index 0c16fae01bca7..a211eee688fa8 100644 --- a/src/bootstrap/cache.rs +++ b/src/bootstrap/cache.rs @@ -245,7 +245,7 @@ impl Cache { Cache(RefCell::new(HashMap::new())) } - pub fn put(&self, step: S, value: S::Output) { + pub(crate) fn put(&self, step: S, value: S::Output) { let mut cache = self.0.borrow_mut(); let type_id = TypeId::of::(); let stepcache = cache @@ -257,7 +257,7 @@ impl Cache { stepcache.insert(step, value); } - pub fn get(&self, step: &S) -> Option { + pub(crate) fn get(&self, step: &S) -> Option { let mut cache = self.0.borrow_mut(); let type_id = TypeId::of::(); let stepcache = cache @@ -271,7 +271,7 @@ impl Cache { #[cfg(test)] impl Cache { - pub fn all(&mut self) -> Vec<(S, S::Output)> { + pub fn all(&mut self) -> Vec<(S, S::Output)> { let cache = self.0.get_mut(); let type_id = TypeId::of::(); let mut v = cache @@ -279,7 +279,7 @@ impl Cache { .map(|b| b.downcast::>().expect("correct type")) .map(|m| m.into_iter().collect::>()) .unwrap_or_default(); - v.sort_by_key(|&(a, _)| a); + v.sort_by_key(|(a, _)| a.clone()); v } diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index bc106746e57e0..e3e11a004b7f3 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -1,6 +1,6 @@ //! Implementation of compiling the compiler and standard library, in "check"-based modes. -use crate::builder::{Builder, Kind, RunConfig, ShouldRun, Step}; +use crate::builder::{Builder, Kind, RunConfig, ShouldRun, Step, StepInfo}; use crate::cache::Interned; use crate::compile::{add_to_sysroot, run_cargo, rustc_cargo, rustc_cargo_env, std_cargo}; use crate::config::TargetSelection; @@ -71,6 +71,13 @@ impl Step for Std { run.builder.ensure(Std { target: run.target }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + let builder = step_info.builder; + let compiler = builder.compiler(builder.top_stage, builder.config.build); + step_info.compiler(compiler).target(step.target).cmd(Kind::Check); + } + fn run(self, builder: &Builder<'_>) { builder.update_submodule(&Path::new("library").join("stdarch")); @@ -86,10 +93,7 @@ impl Step for Std { ); std_cargo(builder, target, compiler.stage, &mut cargo); - builder.info(&format!( - "Checking stage{} std artifacts ({} -> {})", - builder.top_stage, &compiler.host, target - )); + builder.step_info(&self); run_cargo( builder, cargo, @@ -133,7 +137,7 @@ impl Step for Std { } builder.info(&format!( - "Checking stage{} std test/bench/example targets ({} -> {})", + "check library/alloc --stage {} --all-targets --host {} --target {}", builder.top_stage, &compiler.host, target )); run_cargo( @@ -166,6 +170,13 @@ impl Step for Rustc { run.builder.ensure(Rustc { target: run.target }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + let builder = step_info.builder; + let compiler = builder.compiler(builder.top_stage, builder.config.build); + step_info.compiler(compiler).target(step.target).cmd(Kind::Check); + } + /// Builds the compiler. /// /// This will build the compiler for a particular stage of the build using @@ -206,10 +217,7 @@ impl Step for Rustc { cargo.arg("-p").arg(krate.name); } - builder.info(&format!( - "Checking stage{} compiler artifacts ({} -> {})", - builder.top_stage, &compiler.host, target - )); + builder.step_info(&self); run_cargo( builder, cargo, @@ -246,6 +254,11 @@ impl Step for CodegenBackend { } } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.target(step.target).cmd(Kind::Check); + } + fn run(self, builder: &Builder<'_>) { let compiler = builder.compiler(builder.top_stage, builder.config.build); let target = self.target; @@ -265,10 +278,7 @@ impl Step for CodegenBackend { .arg(builder.src.join(format!("compiler/rustc_codegen_{}/Cargo.toml", backend))); rustc_cargo_env(builder, &mut cargo, target); - builder.info(&format!( - "Checking stage{} {} artifacts ({} -> {})", - builder.top_stage, backend, &compiler.host.triple, target.triple - )); + builder.step_info(&self); run_cargo( builder, @@ -302,6 +312,13 @@ macro_rules! tool_check_step { run.builder.ensure($name { target: run.target }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + let builder = step_info.builder; + let compiler = builder.compiler(builder.top_stage, builder.config.build); + step_info.compiler(compiler).target(step.target).cmd(Kind::Check); + } + fn run(self, builder: &Builder<'_>) { let compiler = builder.compiler(builder.top_stage, builder.config.build); let target = self.target; @@ -328,13 +345,7 @@ macro_rules! tool_check_step { // See https://github.com/rust-lang/rust/pull/80573#issuecomment-754010776 cargo.rustflag("-Zunstable-options"); - builder.info(&format!( - "Checking stage{} {} artifacts ({} -> {})", - builder.top_stage, - stringify!($name).to_lowercase(), - &compiler.host.triple, - target.triple - )); + builder.step_info(&self); run_cargo( builder, cargo, diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 78c9a25262243..2bb1f747594e6 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -21,7 +21,7 @@ use filetime::FileTime; use serde::Deserialize; use crate::builder::Cargo; -use crate::builder::{Builder, Kind, RunConfig, ShouldRun, Step}; +use crate::builder::{Builder, Kind, RunConfig, ShouldRun, Step, StepInfo}; use crate::cache::{Interned, INTERNER}; use crate::config::TargetSelection; use crate::dist; @@ -54,6 +54,11 @@ impl Step for Std { }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.compiler(&step.compiler).target(step.target).cmd(Kind::Build); + } + /// Builds the standard library. /// /// This will build the standard library for a particular stage of the build @@ -107,10 +112,7 @@ impl Step for Std { let mut cargo = builder.cargo(compiler, Mode::Std, SourceType::InTree, target, "build"); std_cargo(builder, target, compiler.stage, &mut cargo); - builder.info(&format!( - "Building stage{} std artifacts ({} -> {})", - compiler.stage, &compiler.host, target - )); + builder.step_info(&self); run_cargo( builder, cargo, @@ -351,6 +353,8 @@ impl Step for StdLink { run.never() } + fn info(_step_info: &mut StepInfo<'_, '_, Self>) {} + /// Link all libstd rlibs/dylibs into the sysroot location. /// /// Links those artifacts generated by `compiler` to the `stage` compiler's @@ -447,6 +451,11 @@ impl Step for StartupObjects { }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.compiler(&step.compiler).cmd(Kind::Build); + } + /// Builds and prepare startup objects like rsbegin.o and rsend.o /// /// These are primarily used on Windows right now for linking executables/dlls. @@ -518,6 +527,11 @@ impl Step for Rustc { }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.compiler(&step.compiler).target(step.target).cmd(Kind::Build); + } + /// Builds the compiler. /// /// This will build the compiler for a particular stage of the build using @@ -602,10 +616,7 @@ impl Step for Rustc { )); } - builder.info(&format!( - "Building stage{} compiler artifacts ({} -> {})", - compiler.stage, &compiler.host, target - )); + builder.step_info(&self); run_cargo( builder, cargo, @@ -723,6 +734,8 @@ impl Step for RustcLink { run.never() } + fn info(_step_info: &mut StepInfo<'_, '_, Self>) {} + /// Same as `std_link`, only for librustc fn run(self, builder: &Builder<'_>) { let compiler = self.compiler; @@ -772,6 +785,11 @@ impl Step for CodegenBackend { } } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.compiler(&step.compiler).target(step.target).cmd(Kind::Build); + } + fn run(self, builder: &Builder<'_>) { let compiler = self.compiler; let target = self.target; @@ -933,6 +951,8 @@ impl Step for Sysroot { run.never() } + fn info(_step_info: &mut StepInfo<'_, '_, Self>) {} + /// Returns the sysroot for the `compiler` specified that *this build system /// generates*. /// @@ -1005,6 +1025,8 @@ impl Step for Assemble { run.never() } + fn info(_step_info: &mut StepInfo<'_, '_, Self>) {} + /// Prepare a new compiler from the artifacts in `stage` /// /// This will assemble a compiler in `build/$host/stage$stage`. The compiler diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index c37763243c0a5..3ba425eb1cdcf 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -15,7 +15,7 @@ use std::process::Command; use build_helper::{output, t}; -use crate::builder::{Builder, RunConfig, ShouldRun, Step}; +use crate::builder::{Builder, Kind, RunConfig, ShouldRun, Step, StepInfo}; use crate::cache::{Interned, INTERNER}; use crate::compile; use crate::config::TargetSelection; @@ -45,6 +45,15 @@ fn missing_tool(tool_name: &str, skip: bool) { } } +macro_rules! compiler_target_info { + () => { + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.compiler(&step.compiler).target(step.target).cmd(Kind::Dist); + } + }; +} + #[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)] pub struct Docs { pub host: TargetSelection, @@ -62,6 +71,11 @@ impl Step for Docs { run.builder.ensure(Docs { host: run.target }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.target(step.host).cmd(Kind::Dist); + } + /// Builds the `rust-docs` installer component. fn run(self, builder: &Builder<'_>) -> Option { let host = self.host; @@ -97,6 +111,11 @@ impl Step for RustcDocs { run.builder.ensure(RustcDocs { host: run.target }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.target(step.host).cmd(Kind::Dist); + } + /// Builds the `rustc-docs` installer component. fn run(self, builder: &Builder<'_>) -> Option { let host = self.host; @@ -278,6 +297,11 @@ impl Step for Mingw { run.builder.ensure(Mingw { host: run.target }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.target(step.host).cmd(Kind::Dist); + } + /// Builds the `rust-mingw` installer component. /// /// This contains all the bits and pieces to run the MinGW Windows targets @@ -320,6 +344,11 @@ impl Step for Rustc { .ensure(Rustc { compiler: run.builder.compiler(run.builder.top_stage, run.target) }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.compiler(&step.compiler).cmd(Kind::Dist); + } + /// Creates the `rustc` installer component. fn run(self, builder: &Builder<'_>) -> GeneratedTarball { let compiler = self.compiler; @@ -484,6 +513,11 @@ impl Step for DebuggerScripts { }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.target(step.host).cmd(Kind::Dist); + } + /// Copies debugger scripts for `target` into the `sysroot` specified. fn run(self, builder: &Builder<'_>) { let host = self.host; @@ -577,6 +611,8 @@ impl Step for Std { }); } + compiler_target_info!(); + fn run(self, builder: &Builder<'_>) -> Option { let compiler = self.compiler; let target = self.target; @@ -624,6 +660,8 @@ impl Step for RustcDev { }); } + compiler_target_info!(); + fn run(self, builder: &Builder<'_>) -> Option { let compiler = self.compiler; let target = self.target; @@ -694,6 +732,8 @@ impl Step for Analysis { }); } + compiler_target_info!(); + /// Creates a tarball of save-analysis metadata, if available. fn run(self, builder: &Builder<'_>) -> Option { let compiler = self.compiler; @@ -820,6 +860,10 @@ impl Step for Src { run.builder.ensure(Src); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + step_info.cmd(Kind::Dist); + } + /// Creates the `rust-src` installer component fn run(self, builder: &Builder<'_>) -> GeneratedTarball { let tarball = Tarball::new_targetless(builder, "rust-src"); @@ -873,6 +917,10 @@ impl Step for PlainSourceTarball { run.builder.ensure(PlainSourceTarball); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + step_info.cmd(Kind::Dist); + } + /// Creates the plain source tarball fn run(self, builder: &Builder<'_>) -> GeneratedTarball { let tarball = Tarball::new(builder, "rustc", "src"); @@ -971,6 +1019,8 @@ impl Step for Cargo { }); } + compiler_target_info!(); + fn run(self, builder: &Builder<'_>) -> GeneratedTarball { let compiler = self.compiler; let target = self.target; @@ -1025,6 +1075,8 @@ impl Step for Rls { }); } + compiler_target_info!(); + fn run(self, builder: &Builder<'_>) -> Option { let compiler = self.compiler; let target = self.target; @@ -1071,6 +1123,8 @@ impl Step for RustAnalyzer { }); } + compiler_target_info!(); + fn run(self, builder: &Builder<'_>) -> Option { // This prevents rust-analyzer from being built for "dist" or "install" // on the stable/beta channels. It is a nightly-only tool and should @@ -1126,6 +1180,8 @@ impl Step for Clippy { }); } + compiler_target_info!(); + fn run(self, builder: &Builder<'_>) -> GeneratedTarball { let compiler = self.compiler; let target = self.target; @@ -1176,6 +1232,8 @@ impl Step for Miri { }); } + compiler_target_info!(); + fn run(self, builder: &Builder<'_>) -> Option { // This prevents miri from being built for "dist" or "install" // on the stable/beta channels. It is a nightly-only tool and should @@ -1235,6 +1293,8 @@ impl Step for Rustfmt { }); } + compiler_target_info!(); + fn run(self, builder: &Builder<'_>) -> Option { let compiler = self.compiler; let target = self.target; @@ -1287,6 +1347,8 @@ impl Step for RustDemangler { }); } + compiler_target_info!(); + fn run(self, builder: &Builder<'_>) -> Option { let compiler = self.compiler; let target = self.target; @@ -1337,6 +1399,11 @@ impl Step for Extended { }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.stage(step.stage).host(step.host).target(step.target).cmd(Kind::Dist); + } + /// Creates a combined installer for the specified target in the provided stage. fn run(self, builder: &Builder<'_>) { let target = self.target; @@ -2012,6 +2079,11 @@ impl Step for LlvmTools { run.builder.ensure(LlvmTools { target: run.target }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.target(step.target).cmd(Kind::Dist); + } + fn run(self, builder: &Builder<'_>) -> Option { let target = self.target; assert!(builder.config.extended); @@ -2067,6 +2139,11 @@ impl Step for RustDev { run.builder.ensure(RustDev { target: run.target }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.target(step.target).cmd(Kind::Dist); + } + fn run(self, builder: &Builder<'_>) -> Option { let target = self.target; @@ -2135,6 +2212,11 @@ impl Step for BuildManifest { run.builder.ensure(BuildManifest { target: run.target }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.target(step.target).cmd(Kind::Dist); + } + fn run(self, builder: &Builder<'_>) -> GeneratedTarball { let build_manifest = builder.tool_exe(Tool::BuildManifest); @@ -2167,6 +2249,11 @@ impl Step for ReproducibleArtifacts { run.builder.ensure(ReproducibleArtifacts { target: run.target }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.target(step.target).cmd(Kind::Dist); + } + fn run(self, builder: &Builder<'_>) -> Self::Output { let path = builder.config.rust_profile_use.as_ref()?; diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index 9ec5d4d8ccdb4..b0ca86147a15f 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -15,7 +15,7 @@ use std::path::{Path, PathBuf}; use crate::Mode; use build_helper::{t, up_to_date}; -use crate::builder::{Builder, Compiler, RunConfig, ShouldRun, Step}; +use crate::builder::{Builder, Compiler, Kind, RunConfig, ShouldRun, Step, StepInfo}; use crate::cache::{Interned, INTERNER}; use crate::compile; use crate::config::{Config, TargetSelection}; @@ -31,6 +31,32 @@ macro_rules! submodule_helper { }; } +macro_rules! target_info { + () => { + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + step_info.target(step_info.step.target).cmd(Kind::Doc); + } + }; +} + +macro_rules! compiler_target_info { + () => { + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.compiler(&step.compiler).target(step.target).cmd(Kind::Doc); + } + }; +} + +macro_rules! stage_target_info { + () => { + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.stage(step.stage).target(step.target).cmd(Kind::Doc); + } + }; +} + macro_rules! book { ($($name:ident, $path:expr, $book_name:expr $(, submodule $(= $submodule:literal)? )? ;)+) => { $( @@ -54,6 +80,8 @@ macro_rules! book { }); } + target_info!(); + fn run(self, builder: &Builder<'_>) { $( let path = Path::new(submodule_helper!( $path, submodule $( = $submodule )? )); @@ -132,6 +160,8 @@ impl Step for UnstableBook { run.builder.ensure(UnstableBook { target: run.target }); } + target_info!(); + fn run(self, builder: &Builder<'_>) { builder.ensure(UnstableBookGen { target: self.target }); builder.ensure(RustbookSrc { @@ -156,6 +186,8 @@ impl Step for RustbookSrc { run.never() } + target_info!(); + /// Invoke `rustbook` for `target` for the doc book `name` from the `src` path. /// /// This will not actually generate any documentation if the documentation has @@ -203,6 +235,8 @@ impl Step for TheBook { }); } + compiler_target_info!(); + /// Builds the book and associated stuff. /// /// We need to build: @@ -318,6 +352,8 @@ impl Step for Standalone { }); } + compiler_target_info!(); + /// Generates all standalone documentation as compiled by the rustdoc in `stage` /// for the `target` into `out`. /// @@ -434,6 +470,8 @@ impl Step for Std { run.builder.ensure(Std { stage: run.builder.top_stage, target: run.target }); } + stage_target_info!(); + /// Compile all standard library documentation. /// /// This will generate all documentation for the standard library and its @@ -544,6 +582,8 @@ impl Step for Rustc { run.builder.ensure(Rustc { stage: run.builder.top_stage, target: run.target }); } + stage_target_info!(); + /// Generates compiler documentation. /// /// This will generate all documentation for compiler and dependencies. @@ -639,6 +679,8 @@ macro_rules! tool_doc { run.builder.ensure($tool { stage: run.builder.top_stage, target: run.target }); } + stage_target_info!(); + /// Generates compiler documentation. /// /// This will generate all documentation for compiler and dependencies. @@ -735,6 +777,8 @@ impl Step for ErrorIndex { run.builder.ensure(ErrorIndex { target }); } + target_info!(); + /// Generates the HTML rendered error-index by running the /// `error_index_generator` tool. fn run(self, builder: &Builder<'_>) { @@ -769,10 +813,12 @@ impl Step for UnstableBookGen { run.builder.ensure(UnstableBookGen { target: run.target }); } + target_info!(); + fn run(self, builder: &Builder<'_>) { let target = self.target; - builder.info(&format!("Generating unstable book md files ({})", target)); + builder.step_info(&self); let out = builder.md_doc_out(target).join("unstable-book"); builder.create_dir(&out); builder.remove_dir(&out); @@ -828,6 +874,8 @@ impl Step for RustcBook { }); } + compiler_target_info!(); + /// Builds the rustc book. /// /// The lints are auto-generated by a tool, and then merged into the book diff --git a/src/bootstrap/install.rs b/src/bootstrap/install.rs index 8a1b6df0dafe3..ed42a203a398e 100644 --- a/src/bootstrap/install.rs +++ b/src/bootstrap/install.rs @@ -14,7 +14,7 @@ use crate::dist::{self, sanitize_sh}; use crate::tarball::GeneratedTarball; use crate::Compiler; -use crate::builder::{Builder, RunConfig, ShouldRun, Step}; +use crate::builder::{Builder, Kind, RunConfig, ShouldRun, Step, StepInfo}; use crate::config::{Config, TargetSelection}; #[cfg(target_os = "illumos")] @@ -90,6 +90,15 @@ fn prepare_dir(mut path: PathBuf) -> String { sanitize_sh(&path) } +macro_rules! compiler_target_info { + () => { + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.compiler(&step.compiler).target(step.target).cmd(Kind::Install); + } + }; +} + macro_rules! install { (($sel:ident, $builder:ident, $_config:ident), $($name:ident, @@ -130,6 +139,8 @@ macro_rules! install { }); } + compiler_target_info!(); + fn run($sel, $builder: &Builder<'_>) { $run_item } @@ -262,6 +273,10 @@ impl Step for Src { run.builder.ensure(Src { stage: run.builder.top_stage }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + step_info.stage(step_info.step.stage).cmd(Kind::Install); + } + fn run(self, builder: &Builder<'_>) { let tarball = builder.ensure(dist::Src); install_sh(builder, "src", self.stage, None, &tarball); diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index 1be414b29a1ae..695c159ffc832 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -18,12 +18,20 @@ use std::process::Command; use build_helper::{output, t}; -use crate::builder::{Builder, RunConfig, ShouldRun, Step}; +use crate::builder::{Builder, Kind, RunConfig, ShouldRun, Step, StepInfo}; use crate::config::TargetSelection; use crate::util::{self, exe}; use crate::GitRepo; use build_helper::up_to_date; +macro_rules! target_info { + () => { + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + step_info.target(step_info.step.target).cmd(Kind::Build); + } + }; +} + pub struct Meta { stamp: HashStamp, build_llvm_config: PathBuf, @@ -109,6 +117,8 @@ impl Step for Llvm { run.builder.ensure(Llvm { target: run.target }); } + target_info!(); + /// Compile LLVM for `target`. fn run(self, builder: &Builder<'_>) -> PathBuf { let target = self.target; @@ -135,7 +145,7 @@ impl Step for Llvm { panic!("shared linking to LLVM is not currently supported on {}", target.triple); } - builder.info(&format!("Building LLVM for {}", target)); + builder.step_info(&self); t!(stamp.remove()); let _time = util::timeit(&builder); t!(fs::create_dir_all(&out_dir)); @@ -539,6 +549,8 @@ impl Step for Lld { run.builder.ensure(Lld { target: run.target }); } + target_info!(); + /// Compile LLD for `target`. fn run(self, builder: &Builder<'_>) -> PathBuf { if builder.config.dry_run { @@ -554,7 +566,7 @@ impl Step for Lld { return out_dir; } - builder.info(&format!("Building LLD for {}", target)); + builder.step_info(&self); let _time = util::timeit(&builder); t!(fs::create_dir_all(&out_dir)); @@ -632,6 +644,8 @@ impl Step for TestHelpers { run.builder.ensure(TestHelpers { target: run.target }) } + target_info!(); + /// Compiles the `rust_test_helpers.c` library which we used in various /// `run-pass` tests for ABI testing. fn run(self, builder: &Builder<'_>) { @@ -652,7 +666,7 @@ impl Step for TestHelpers { return; } - builder.info("Building test helpers"); + builder.step_info(&self); t!(fs::create_dir_all(&dst)); let mut cfg = cc::Build::new(); // FIXME: Workaround for https://github.com/emscripten-core/emscripten/issues/9013 @@ -697,6 +711,8 @@ impl Step for Sanitizers { run.builder.ensure(Sanitizers { target: run.target }); } + target_info!(); + /// Builds sanitizer runtime libraries. fn run(self, builder: &Builder<'_>) -> Self::Output { let compiler_rt_dir = builder.src.join("src/llvm-project/compiler-rt"); @@ -728,7 +744,7 @@ impl Step for Sanitizers { return runtimes; } - builder.info(&format!("Building sanitizers for {}", self.target)); + builder.step_info(&self); t!(stamp.remove()); let _time = util::timeit(&builder); @@ -876,6 +892,8 @@ impl Step for CrtBeginEnd { run.builder.ensure(CrtBeginEnd { target: run.target }); } + target_info!(); + /// Build crtbegin.o/crtend.o for musl target. fn run(self, builder: &Builder<'_>) -> Self::Output { let out_dir = builder.native_dir(self.target).join("crt"); @@ -892,7 +910,7 @@ impl Step for CrtBeginEnd { return out_dir; } - builder.info("Building crtbegin.o and crtend.o"); + builder.step_info(&self); t!(fs::create_dir_all(&out_dir)); let mut cfg = cc::Build::new(); diff --git a/src/bootstrap/run.rs b/src/bootstrap/run.rs index 7c64e5a0aadc8..92ec8fe46302f 100644 --- a/src/bootstrap/run.rs +++ b/src/bootstrap/run.rs @@ -1,4 +1,4 @@ -use crate::builder::{Builder, RunConfig, ShouldRun, Step}; +use crate::builder::{Builder, Kind, RunConfig, ShouldRun, Step, StepInfo}; use crate::dist::distdir; use crate::tool::Tool; use build_helper::output; @@ -22,6 +22,10 @@ impl Step for ExpandYamlAnchors { ); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + step_info.cmd(Kind::Run); + } + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { run.path("src/tools/expand-yaml-anchors") } @@ -59,6 +63,10 @@ impl Step for BuildManifest { run.builder.ensure(BuildManifest); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + step_info.cmd(Kind::Run); + } + fn run(self, builder: &Builder<'_>) { // This gets called by `promote-release` // (https://github.com/rust-lang/promote-release). diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 31f18d81c7c0f..243bb95597410 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -13,7 +13,7 @@ use std::process::{Command, Stdio}; use build_helper::{self, output, t}; -use crate::builder::{Builder, Compiler, Kind, RunConfig, ShouldRun, Step}; +use crate::builder::{Builder, Compiler, Kind, RunConfig, ShouldRun, Step, StepInfo}; use crate::cache::Interned; use crate::compile; use crate::config::TargetSelection; @@ -26,6 +26,33 @@ use crate::util::{self, add_link_lib_path, dylib_path, dylib_path_var}; use crate::Crate as CargoCrate; use crate::{envify, DocTests, GitRepo, Mode}; +macro_rules! host_info { + () => { + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.host(step.host).cmd(Kind::Test); + } + }; +} + +macro_rules! stage_host_info { + () => { + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.stage(step.stage).host(step.host).cmd(Kind::Test); + } + }; +} + +macro_rules! compiler_target_info { + () => { + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.compiler(&step.compiler).target(step.target).cmd(Kind::Test); + } + }; +} + const ADB_TEST_DIR: &str = "/data/tmp/work"; /// The two modes of the test runner; tests or benchmarks. @@ -150,6 +177,11 @@ You can skip linkcheck with --exclude src/tools/linkchecker" ); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.host(step.host).cmd(Kind::Test); + } + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { let builder = run.builder; let run = run.path("src/tools/linkchecker"); @@ -188,6 +220,10 @@ impl Step for HtmlCheck { run.builder.ensure(HtmlCheck { target: run.target }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + step_info.target(step_info.step.target).cmd(Kind::Test); + } + fn run(self, builder: &Builder<'_>) { if !check_if_tidy_is_installed() { eprintln!("not running HTML-check tool because `tidy` is missing"); @@ -222,6 +258,8 @@ impl Step for Cargotest { run.builder.ensure(Cargotest { stage: run.builder.top_stage, host: run.target }); } + stage_host_info!(); + /// Runs the `cargotest` tool as compiled in `stage` by the `host` compiler. /// /// This tool in `src/tools` will check out a few Rust projects and run `cargo @@ -268,6 +306,8 @@ impl Step for Cargo { run.builder.ensure(Cargo { stage: run.builder.top_stage, host: run.target }); } + stage_host_info!(); + /// Runs `cargo test` for `cargo` packaged with Rust. fn run(self, builder: &Builder<'_>) { let compiler = builder.compiler(self.stage, self.host); @@ -322,6 +362,8 @@ impl Step for Rls { run.builder.ensure(Rls { stage: run.builder.top_stage, host: run.target }); } + stage_host_info!(); + /// Runs `cargo test` for the rls. fn run(self, builder: &Builder<'_>) { let stage = self.stage; @@ -373,6 +415,8 @@ impl Step for Rustfmt { run.builder.ensure(Rustfmt { stage: run.builder.top_stage, host: run.target }); } + stage_host_info!(); + /// Runs `cargo test` for rustfmt. fn run(self, builder: &Builder<'_>) { let stage = self.stage; @@ -422,6 +466,8 @@ impl Step for RustDemangler { run.builder.ensure(RustDemangler { stage: run.builder.top_stage, host: run.target }); } + stage_host_info!(); + /// Runs `cargo test` for rust-demangler. fn run(self, builder: &Builder<'_>) { let stage = self.stage; @@ -473,6 +519,8 @@ impl Step for Miri { run.builder.ensure(Miri { stage: run.builder.top_stage, host: run.target }); } + stage_host_info!(); + /// Runs `cargo test` for miri. fn run(self, builder: &Builder<'_>) { let stage = self.stage; @@ -605,6 +653,8 @@ impl Step for CompiletestTest { run.builder.ensure(CompiletestTest { host: run.target }); } + host_info!(); + /// Runs `cargo test` for compiletest. fn run(self, builder: &Builder<'_>) { let host = self.host; @@ -647,6 +697,8 @@ impl Step for Clippy { run.builder.ensure(Clippy { stage: run.builder.top_stage, host: run.target }); } + stage_host_info!(); + /// Runs `cargo test` for clippy. fn run(self, builder: &Builder<'_>) { let stage = self.stage; @@ -738,6 +790,11 @@ impl Step for RustdocTheme { run.builder.ensure(RustdocTheme { compiler }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.compiler(step.compiler).cmd(Kind::Test); + } + fn run(self, builder: &Builder<'_>) { let rustdoc = builder.out.join("bootstrap/debug/rustdoc"); let mut cmd = builder.tool_cmd(Tool::RustdocTheme); @@ -777,6 +834,11 @@ impl Step for RustdocJSStd { run.builder.ensure(RustdocJSStd { target: run.target }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.target(step.target).cmd(Kind::Test); + } + fn run(self, builder: &Builder<'_>) { if let Some(ref nodejs) = builder.config.nodejs { let mut command = Command::new(nodejs); @@ -818,6 +880,8 @@ impl Step for RustdocJSNotStd { run.builder.ensure(RustdocJSNotStd { target: run.target, compiler }); } + compiler_target_info!(); + fn run(self, builder: &Builder<'_>) { if builder.config.nodejs.is_some() { builder.ensure(Compiletest { @@ -882,6 +946,8 @@ impl Step for RustdocGUI { run.builder.ensure(RustdocGUI { target: run.target, compiler }); } + compiler_target_info!(); + fn run(self, builder: &Builder<'_>) { let nodejs = builder.config.nodejs.as_ref().expect("nodejs isn't available"); let npm = builder.config.npm.as_ref().expect("npm isn't available"); @@ -977,11 +1043,11 @@ impl Step for Tidy { cmd.arg("--verbose"); } - builder.info("tidy check"); + builder.step_info(&self); try_run(builder, &mut cmd); if builder.config.channel == "dev" || builder.config.channel == "nightly" { - builder.info("fmt check"); + builder.info("fmt --check"); if builder.config.initial_rustfmt.is_none() { let inferred_rustfmt_dir = builder.config.initial_rustc.parent().unwrap(); eprintln!( @@ -999,6 +1065,10 @@ help: to skip test's attempt to check tidiness, pass `--exclude src/tools/tidy` } } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + step_info.cmd(Kind::Test); + } + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { run.path("src/tools/tidy") } @@ -1028,6 +1098,10 @@ impl Step for ExpandYamlAnchors { ); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + step_info.cmd(Kind::Test); + } + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { run.path("src/tools/expand-yaml-anchors") } @@ -1125,6 +1199,8 @@ macro_rules! test_definitions { run.builder.ensure($name { compiler, target: run.target }); } + compiler_target_info!(); + fn run(self, builder: &Builder<'_>) { builder.ensure(Compiletest { compiler: self.compiler, @@ -1215,6 +1291,16 @@ impl Step for Compiletest { run.never() } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + // FIXME: it would be nice to suggest exactly the tests that fail, but that info isn't known without first running compiletest. + step_info + .path(step.path.into()) + .compiler(&step.compiler) + .target(step.target) + .cmd(Kind::Test); + } + /// Executes the `compiletest` tool to run a suite of tests. /// /// Compiles all tests with `compiler` for `target` with the specified @@ -1584,10 +1670,7 @@ note: if you're sure you want to do this, please open an issue as to why. In the builder.ci_env.force_coloring_in_ci(&mut cmd); - builder.info(&format!( - "Check compiletest suite={} mode={} ({} -> {})", - suite, mode, &compiler.host, target - )); + builder.step_info(&self); let _time = util::timeit(&builder); try_run(builder, &mut cmd); @@ -1619,6 +1702,11 @@ impl Step for BookTest { run.never() } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.path(step.path.clone()).compiler(&step.compiler).cmd(Kind::Test); + } + /// Runs the documentation tests for a book in `src/doc`. /// /// This uses the `rustdoc` that sits next to `compiler`. @@ -1725,6 +1813,11 @@ macro_rules! test_book { }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.compiler(&step.compiler).cmd(Kind::Test); + } + fn run(self, builder: &Builder<'_>) { builder.ensure(BookTest { compiler: self.compiler, @@ -1772,6 +1865,11 @@ impl Step for ErrorIndex { run.builder.ensure(ErrorIndex { compiler }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.compiler(&step.compiler).cmd(Kind::Test); + } + /// Runs the error index generator tool to execute the tests located in the error /// index. /// @@ -1841,6 +1939,10 @@ impl Step for RustcGuide { run.builder.ensure(RustcGuide); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + step_info.cmd(Kind::Test); + } + fn run(self, builder: &Builder<'_>) { let relative_path = Path::new("src").join("doc").join("rustc-dev-guide"); builder.update_submodule(&relative_path); @@ -1856,12 +1958,13 @@ impl Step for RustcGuide { } } -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct CrateLibrustc { compiler: Compiler, target: TargetSelection, test_kind: TestKind, - krate: Interned, + krate_name: Interned, + krate_path: PathBuf, } impl Step for CrateLibrustc { @@ -1885,30 +1988,39 @@ impl Step for CrateLibrustc { compiler, target: run.target, test_kind, - krate: krate.name, + krate_name: krate.name, + krate_path: krate.local_path(builder.build), }); } } } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.path(step.krate_path.clone()); + step_info.compiler(&step.compiler).target(step.target).cmd(Kind::Test); + } + fn run(self, builder: &Builder<'_>) { builder.ensure(Crate { compiler: self.compiler, target: self.target, mode: Mode::Rustc, test_kind: self.test_kind, - krate: self.krate, + krate_name: self.krate_name, + krate_path: self.krate_path.clone(), }); } } -#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Crate { pub compiler: Compiler, pub target: TargetSelection, pub mode: Mode, pub test_kind: TestKind, - pub krate: Interned, + pub krate_name: Interned, + pub krate_path: PathBuf, } impl Step for Crate { @@ -1931,7 +2043,8 @@ impl Step for Crate { target: run.target, mode, test_kind, - krate: krate.name, + krate_name: krate.name, + krate_path: krate.local_path(builder.build), }); }; @@ -1942,6 +2055,14 @@ impl Step for Crate { } } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + // FIXME: it would be nice to suggest exactly the tests that fail, but that info isn't known without first running compiletest. + step_info + .path(step.krate_path.file_name().expect("top-level directory is not a crate").into()); + step_info.compiler(&step.compiler).target(step.target).cmd(Kind::Test); + } + /// Runs all unit tests plus documentation tests for a given crate defined /// by a `Cargo.toml` (single manifest) /// @@ -1955,7 +2076,7 @@ impl Step for Crate { let target = self.target; let mode = self.mode; let test_kind = self.test_kind; - let krate = self.krate; + let krate = self.krate_name; builder.ensure(compile::Std { compiler, target }); builder.ensure(RemoteCopyLibs { compiler, target }); @@ -2064,6 +2185,11 @@ impl Step for CrateRustdoc { builder.ensure(CrateRustdoc { host: run.target, test_kind }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.host(step.host).cmd(Kind::Test); + } + fn run(self, builder: &Builder<'_>) { let test_kind = self.test_kind; let target = self.host; @@ -2161,6 +2287,11 @@ impl Step for CrateRustdocJsonTypes { builder.ensure(CrateRustdocJsonTypes { host: run.target, test_kind }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.host(step.host).cmd(Kind::Test); + } + fn run(self, builder: &Builder<'_>) { let test_kind = self.test_kind; let target = self.host; @@ -2231,6 +2362,8 @@ impl Step for RemoteCopyLibs { run.never() } + compiler_target_info!(); + fn run(self, builder: &Builder<'_>) { let compiler = self.compiler; let target = self.target; @@ -2279,6 +2412,10 @@ impl Step for Distcheck { run.builder.ensure(Distcheck); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + step_info.cmd(Kind::Test); + } + /// Runs "distcheck", a 'make check' from a tarball fn run(self, builder: &Builder<'_>) { builder.info("Distcheck"); @@ -2367,6 +2504,10 @@ impl Step for Bootstrap { try_run(builder, &mut cmd); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + step_info.cmd(Kind::Test); + } + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { run.path("src/bootstrap") } @@ -2396,6 +2537,11 @@ impl Step for TierCheck { run.builder.ensure(TierCheck { compiler }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.compiler(step.compiler).cmd(Kind::Test); + } + /// Tests the Platform Support page in the rustc book. fn run(self, builder: &Builder<'_>) { builder.ensure(compile::Std { compiler: self.compiler, target: self.compiler.host }); @@ -2442,6 +2588,8 @@ impl Step for LintDocs { }); } + compiler_target_info!(); + /// Tests that the lint examples in the rustc book generate the correct /// lints and have the expected format. fn run(self, builder: &Builder<'_>) { diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index f5e3f61dcc88f..0638dc45f3079 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -6,7 +6,7 @@ use std::process::{exit, Command}; use build_helper::t; -use crate::builder::{Builder, Cargo as CargoCommand, RunConfig, ShouldRun, Step}; +use crate::builder::{Builder, Cargo as CargoCommand, Kind, RunConfig, ShouldRun, Step, StepInfo}; use crate::channel::GitInfo; use crate::compile; use crate::config::TargetSelection; @@ -40,6 +40,13 @@ impl Step for ToolBuild { run.never() } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + // todo!("path"); + step_info.path(step.path.into()); + step_info.compiler(&step.compiler).target(step.target).cmd(Kind::Build); + } + /// Builds a tool in `src/tools` /// /// This will build the specified tool with the specified `host` compiler in @@ -72,7 +79,7 @@ impl Step for ToolBuild { &self.extra_features, ); - builder.info(&format!("Building stage{} tool {} ({})", compiler.stage, tool, target)); + builder.step_info(&self); let mut duplicates = Vec::new(); let is_expected = compile::stream_cargo(builder, cargo, vec![], &mut |msg| { // Only care about big things like the RLS/Cargo for now @@ -319,6 +326,11 @@ macro_rules! bootstrap_tool { impl Step for $name { type Output = PathBuf; + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.compiler(&step.compiler).target(step.target).cmd(Kind::Build); + } + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { run.path($path) } @@ -427,6 +439,11 @@ impl Step for ErrorIndex { run.builder.ensure(ErrorIndex { compiler }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.compiler(&step.compiler).cmd(Kind::Build); + } + fn run(self, builder: &Builder<'_>) -> PathBuf { builder .ensure(ToolBuild { @@ -463,6 +480,11 @@ impl Step for RemoteTestServer { }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.compiler(&step.compiler).target(step.target).cmd(Kind::Build); + } + fn run(self, builder: &Builder<'_>) -> PathBuf { builder .ensure(ToolBuild { @@ -495,6 +517,11 @@ impl Step for Rustdoc { run.path("src/tools/rustdoc").path("src/librustdoc") } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.compiler(&step.compiler).cmd(Kind::Build); + } + fn make_run(run: RunConfig<'_>) { run.builder.ensure(Rustdoc { // Note: this is somewhat unique in that we actually want a *target* @@ -556,10 +583,7 @@ impl Step for Rustdoc { features.as_slice(), ); - builder.info(&format!( - "Building rustdoc for stage{} ({})", - target_compiler.stage, target_compiler.host - )); + builder.step_info(&self); builder.run(&mut cargo.into()); // Cargo adds a number of paths to the dylib search path on windows, which results in @@ -595,6 +619,11 @@ impl Step for Cargo { const DEFAULT: bool = true; const ONLY_HOSTS: bool = true; + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.compiler(&step.compiler).target(step.target).cmd(Kind::Build); + } + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { let builder = run.builder; run.path("src/tools/cargo").default_condition( @@ -712,6 +741,11 @@ macro_rules! tool_extended { }); } + fn info(step_info: &mut StepInfo<'_, '_, Self>) { + let step = step_info.step; + step_info.compiler(&step.compiler).target(step.target).cmd(Kind::Check); + } + #[allow(unused_mut)] fn run(mut $sel, $builder: &Builder<'_>) -> Option { $extra_deps diff --git a/src/bootstrap/toolstate.rs b/src/bootstrap/toolstate.rs index 2394c5e020d2b..4292d7fee9a59 100644 --- a/src/bootstrap/toolstate.rs +++ b/src/bootstrap/toolstate.rs @@ -1,4 +1,4 @@ -use crate::builder::{Builder, RunConfig, ShouldRun, Step}; +use crate::builder::{Builder, RunConfig, ShouldRun, Step, StepInfo}; use build_helper::t; use serde::{Deserialize, Serialize}; use std::collections::HashMap; @@ -141,6 +141,8 @@ pub struct ToolStateCheck; impl Step for ToolStateCheck { type Output = (); + fn info(_step_info: &mut StepInfo<'_, '_, Self>) {} + /// Checks tool state status. /// /// This is intended to be used in the `checktools.sh` script. To use diff --git a/src/doc/book b/src/doc/book index eac5531421051..55a26488ddefc 160000 --- a/src/doc/book +++ b/src/doc/book @@ -1 +1 @@ -Subproject commit eac55314210519238652f12b30fec9daea61f7fe +Subproject commit 55a26488ddefc8433e73a2e8352d70f7a5c7fc2b diff --git a/src/doc/edition-guide b/src/doc/edition-guide index af696ce8ea526..302a115e8f718 160000 --- a/src/doc/edition-guide +++ b/src/doc/edition-guide @@ -1 +1 @@ -Subproject commit af696ce8ea526445590ae0ca66a8128d2a95a69a +Subproject commit 302a115e8f71876dfc884aebb0ca5ccb02b8a962 diff --git a/src/doc/embedded-book b/src/doc/embedded-book index 09986cd352404..7349d173fa28a 160000 --- a/src/doc/embedded-book +++ b/src/doc/embedded-book @@ -1 +1 @@ -Subproject commit 09986cd352404eb4659db44613b27cac9aa652fc +Subproject commit 7349d173fa28a0bb834cf0264a05286620ef0923 diff --git a/src/doc/nomicon b/src/doc/nomicon index 7a13537f96af4..55de6fa3c1f33 160000 --- a/src/doc/nomicon +++ b/src/doc/nomicon @@ -1 +1 @@ -Subproject commit 7a13537f96af4b9b8e3ea296d6e5c3c7ab72ce9f +Subproject commit 55de6fa3c1f331774da19472c9ee57d2ae9eb039 diff --git a/src/doc/reference b/src/doc/reference index 82d75cf423e4a..9c68af3ce6ccc 160000 --- a/src/doc/reference +++ b/src/doc/reference @@ -1 +1 @@ -Subproject commit 82d75cf423e4a7824fb36e73ccb18519d6900610 +Subproject commit 9c68af3ce6ccca2395e1868addef26a0542e9ddd diff --git a/src/doc/rust-by-example b/src/doc/rust-by-example index 1db6bb483cc87..805e016c5792a 160000 --- a/src/doc/rust-by-example +++ b/src/doc/rust-by-example @@ -1 +1 @@ -Subproject commit 1db6bb483cc87ad3b424d9aba764fe622960a1be +Subproject commit 805e016c5792ad2adabb66e348233067d5ea9f10 diff --git a/src/doc/rustc-dev-guide b/src/doc/rustc-dev-guide index 93422c21baca5..50de7f0682adc 160000 --- a/src/doc/rustc-dev-guide +++ b/src/doc/rustc-dev-guide @@ -1 +1 @@ -Subproject commit 93422c21baca585dc88357ec886a48f6ddc7d665 +Subproject commit 50de7f0682adc5d95ce858fe6318d19b4b951553 diff --git a/src/tools/rust-analyzer b/src/tools/rust-analyzer index ea105f9396a9d..f4383981249d3 160000 --- a/src/tools/rust-analyzer +++ b/src/tools/rust-analyzer @@ -1 +1 @@ -Subproject commit ea105f9396a9dab68e71efb06016b7c76c83ba7c +Subproject commit f4383981249d3f2964f2c667f3349f8ff15b77c4