Skip to content

Commit b92b352

Browse files
committed
Review remarks
1 parent ca6e367 commit b92b352

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
@@ -1606,7 +1606,7 @@ impl Step for GccCodegenBackend {
16061606
let _guard = builder.msg_rustc_tool(
16071607
Kind::Build,
16081608
build_compiler.stage,
1609-
format_args!("codegen backend gcc"),
1609+
"codegen backend gcc",
16101610
build_compiler.host,
16111611
target,
16121612
);
@@ -1690,7 +1690,7 @@ impl Step for CraneliftCodegenBackend {
16901690
let _guard = builder.msg_rustc_tool(
16911691
Kind::Build,
16921692
build_compiler.stage,
1693-
format_args!("codegen backend cranelift"),
1693+
"codegen backend cranelift",
16941694
build_compiler.host,
16951695
target,
16961696
);
@@ -1712,32 +1712,28 @@ fn write_codegen_backend_stamp(
17121712
files: Vec<PathBuf>,
17131713
dry_run: bool,
17141714
) -> BuildStamp {
1715-
if !dry_run {
1716-
let mut files = files.into_iter().filter(|f| {
1717-
let filename = f.file_name().unwrap().to_str().unwrap();
1718-
is_dylib(f) && filename.contains("rustc_codegen_")
1719-
});
1720-
let codegen_backend = match files.next() {
1721-
Some(f) => f,
1722-
None => panic!("no dylibs built for codegen backend?"),
1723-
};
1724-
if let Some(f) = files.next() {
1725-
panic!(
1726-
"codegen backend built two dylibs:\n{}\n{}",
1727-
codegen_backend.display(),
1728-
f.display()
1729-
);
1730-
}
1715+
if dry_run {
1716+
return stamp;
1717+
}
17311718

1732-
let codegen_backend = codegen_backend.to_str().unwrap();
1733-
stamp = stamp.add_stamp(codegen_backend);
1734-
t!(stamp.write());
1719+
let mut files = files.into_iter().filter(|f| {
1720+
let filename = f.file_name().unwrap().to_str().unwrap();
1721+
is_dylib(f) && filename.contains("rustc_codegen_")
1722+
});
1723+
let codegen_backend = match files.next() {
1724+
Some(f) => f,
1725+
None => panic!("no dylibs built for codegen backend?"),
1726+
};
1727+
if let Some(f) = files.next() {
1728+
panic!("codegen backend built two dylibs:\n{}\n{}", codegen_backend.display(), f.display());
17351729
}
1730+
1731+
let codegen_backend = codegen_backend.to_str().unwrap();
1732+
stamp = stamp.add_stamp(codegen_backend);
1733+
t!(stamp.write());
17361734
stamp
17371735
}
17381736

1739-
pub(crate) const CODEGEN_BACKEND_PREFIX: &str = "rustc_codegen_";
1740-
17411737
/// Creates the `codegen-backends` folder for a compiler that's about to be
17421738
/// assembled as a complete compiler.
17431739
///

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

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

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
44
use serde::{Deserialize, Deserializer};
55

6-
use crate::core::build_steps::compile::CODEGEN_BACKEND_PREFIX;
76
use crate::core::config::toml::TomlConfig;
87
use crate::core::config::{DebuginfoLevel, Merge, ReplaceOpt, StringOrBool};
98
use crate::{BTreeSet, CodegenBackendKind, HashSet, PathBuf, TargetSelection, define_config, exit};
@@ -391,6 +390,8 @@ pub(crate) fn parse_codegen_backends(
391390
backends: Vec<String>,
392391
section: &str,
393392
) -> Vec<CodegenBackendKind> {
393+
const CODEGEN_BACKEND_PREFIX: &str = "rustc_codegen_";
394+
394395
let mut found_backends = vec![];
395396
for backend in &backends {
396397
if let Some(stripped) = backend.strip_prefix(CODEGEN_BACKEND_PREFIX) {

0 commit comments

Comments
 (0)