diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index 1dfbf64a9557..79174eb281f6 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -1606,7 +1606,7 @@ impl Step for GccCodegenBackend { let _guard = builder.msg_rustc_tool( Kind::Build, build_compiler.stage, - format_args!("codegen backend gcc"), + "codegen backend gcc", build_compiler.host, target, ); @@ -1690,7 +1690,7 @@ impl Step for CraneliftCodegenBackend { let _guard = builder.msg_rustc_tool( Kind::Build, build_compiler.stage, - format_args!("codegen backend cranelift"), + "codegen backend cranelift", build_compiler.host, target, ); @@ -1712,32 +1712,28 @@ fn write_codegen_backend_stamp( files: Vec, dry_run: bool, ) -> BuildStamp { - if !dry_run { - let mut files = files.into_iter().filter(|f| { - let filename = f.file_name().unwrap().to_str().unwrap(); - is_dylib(f) && filename.contains("rustc_codegen_") - }); - let codegen_backend = match files.next() { - Some(f) => f, - None => panic!("no dylibs built for codegen backend?"), - }; - if let Some(f) = files.next() { - panic!( - "codegen backend built two dylibs:\n{}\n{}", - codegen_backend.display(), - f.display() - ); - } - - let codegen_backend = codegen_backend.to_str().unwrap(); - stamp = stamp.add_stamp(codegen_backend); - t!(stamp.write()); + if dry_run { + return stamp; } + + let mut files = files.into_iter().filter(|f| { + let filename = f.file_name().unwrap().to_str().unwrap(); + is_dylib(f) && filename.contains("rustc_codegen_") + }); + let codegen_backend = match files.next() { + Some(f) => f, + None => panic!("no dylibs built for codegen backend?"), + }; + if let Some(f) = files.next() { + panic!("codegen backend built two dylibs:\n{}\n{}", codegen_backend.display(), f.display()); + } + + let codegen_backend = codegen_backend.to_str().unwrap(); + stamp = stamp.add_stamp(codegen_backend); + t!(stamp.write()); stamp } -pub(crate) const CODEGEN_BACKEND_PREFIX: &str = "rustc_codegen_"; - /// Creates the `codegen-backends` folder for a compiler that's about to be /// assembled as a complete compiler. /// diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index b98f1e6dc1dd..3fbc8cdbcd5a 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -1401,7 +1401,7 @@ impl Step for CraneliftCodegenBackend { fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { // We only want to build the cranelift backend in `x dist` if the backend was enabled // in rust.codegen-backends. - // Sadly, we don't have access to the actual for which we're disting clif here.. + // Sadly, we don't have access to the actual target for which we're disting clif here.. // So we just use the host target. let clif_enabled_by_default = run .builder diff --git a/src/bootstrap/src/core/config/toml/rust.rs b/src/bootstrap/src/core/config/toml/rust.rs index b95fb236fa16..3dab8d1d96d5 100644 --- a/src/bootstrap/src/core/config/toml/rust.rs +++ b/src/bootstrap/src/core/config/toml/rust.rs @@ -3,7 +3,6 @@ use serde::{Deserialize, Deserializer}; -use crate::core::build_steps::compile::CODEGEN_BACKEND_PREFIX; use crate::core::config::toml::TomlConfig; use crate::core::config::{DebuginfoLevel, Merge, ReplaceOpt, StringOrBool}; use crate::{BTreeSet, CodegenBackendKind, HashSet, PathBuf, TargetSelection, define_config, exit}; @@ -391,6 +390,8 @@ pub(crate) fn parse_codegen_backends( backends: Vec, section: &str, ) -> Vec { + const CODEGEN_BACKEND_PREFIX: &str = "rustc_codegen_"; + let mut found_backends = vec![]; for backend in &backends { if let Some(stripped) = backend.strip_prefix(CODEGEN_BACKEND_PREFIX) {