Skip to content

Commit e89c64f

Browse files
committed
Review remarks
1 parent 0a3b2d7 commit e89c64f

File tree

3 files changed

+22
-25
lines changed

3 files changed

+22
-25
lines changed

src/bootstrap/src/core/build_steps/compile.rs

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,7 @@ impl Step for GccCodegenBackend {
16101610
let _guard = builder.msg_rustc_tool(
16111611
Kind::Build,
16121612
build_compiler.stage,
1613-
format_args!("codegen backend gcc"),
1613+
"codegen backend gcc",
16141614
build_compiler.host,
16151615
target,
16161616
);
@@ -1694,7 +1694,7 @@ impl Step for CraneliftCodegenBackend {
16941694
let _guard = builder.msg_rustc_tool(
16951695
Kind::Build,
16961696
build_compiler.stage,
1697-
format_args!("codegen backend cranelift"),
1697+
"codegen backend cranelift",
16981698
build_compiler.host,
16991699
target,
17001700
);
@@ -1716,32 +1716,28 @@ fn write_codegen_backend_stamp(
17161716
files: Vec<PathBuf>,
17171717
dry_run: bool,
17181718
) -> BuildStamp {
1719-
if !dry_run {
1720-
let mut files = files.into_iter().filter(|f| {
1721-
let filename = f.file_name().unwrap().to_str().unwrap();
1722-
is_dylib(f) && filename.contains("rustc_codegen_")
1723-
});
1724-
let codegen_backend = match files.next() {
1725-
Some(f) => f,
1726-
None => panic!("no dylibs built for codegen backend?"),
1727-
};
1728-
if let Some(f) = files.next() {
1729-
panic!(
1730-
"codegen backend built two dylibs:\n{}\n{}",
1731-
codegen_backend.display(),
1732-
f.display()
1733-
);
1734-
}
1719+
if dry_run {
1720+
return stamp;
1721+
}
17351722

1736-
let codegen_backend = codegen_backend.to_str().unwrap();
1737-
stamp = stamp.add_stamp(codegen_backend);
1738-
t!(stamp.write());
1723+
let mut files = files.into_iter().filter(|f| {
1724+
let filename = f.file_name().unwrap().to_str().unwrap();
1725+
is_dylib(f) && filename.contains("rustc_codegen_")
1726+
});
1727+
let codegen_backend = match files.next() {
1728+
Some(f) => f,
1729+
None => panic!("no dylibs built for codegen backend?"),
1730+
};
1731+
if let Some(f) = files.next() {
1732+
panic!("codegen backend built two dylibs:\n{}\n{}", codegen_backend.display(), f.display());
17391733
}
1734+
1735+
let codegen_backend = codegen_backend.to_str().unwrap();
1736+
stamp = stamp.add_stamp(codegen_backend);
1737+
t!(stamp.write());
17401738
stamp
17411739
}
17421740

1743-
pub(crate) const CODEGEN_BACKEND_PREFIX: &str = "rustc_codegen_";
1744-
17451741
/// Creates the `codegen-backends` folder for a compiler that's about to be
17461742
/// assembled as a complete compiler.
17471743
///

src/bootstrap/src/core/build_steps/dist.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1379,7 +1379,7 @@ impl Step for CraneliftCodegenBackend {
13791379
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
13801380
// We only want to build the cranelift backend in `x dist` if the backend was enabled
13811381
// in rust.codegen-backends.
1382-
// Sadly, we don't have access to the actual for which we're disting clif here..
1382+
// Sadly, we don't have access to the actual target for which we're disting clif here..
13831383
// So we just use the host target.
13841384
let clif_enabled_by_default = run
13851385
.builder

src/bootstrap/src/core/config/toml/rust.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use std::str::FromStr;
55

66
use serde::{Deserialize, Deserializer};
77

8-
use crate::core::build_steps::compile::CODEGEN_BACKEND_PREFIX;
98
use crate::core::config::toml::TomlConfig;
109
use crate::core::config::{
1110
DebuginfoLevel, Merge, ReplaceOpt, RustcLto, StringOrBool, set, threads_from_config,
@@ -397,6 +396,8 @@ pub(crate) fn parse_codegen_backends(
397396
backends: Vec<String>,
398397
section: &str,
399398
) -> Vec<CodegenBackendKind> {
399+
const CODEGEN_BACKEND_PREFIX: &str = "rustc_codegen_";
400+
400401
let mut found_backends = vec![];
401402
for backend in &backends {
402403
if let Some(stripped) = backend.strip_prefix(CODEGEN_BACKEND_PREFIX) {

0 commit comments

Comments
 (0)