Skip to content

Commit aefd7ac

Browse files
committed
Ensure the rustc-codegen-cranelift-preview component is never empty
Either generate it with the actual codegen backend dylib or omit it entirely when the cranelift backend is disabled for this build.
1 parent 794bf8a commit aefd7ac

File tree

1 file changed

+7
-0
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+7
-0
lines changed

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

+7
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,10 @@ impl Step for CodegenBackend {
13051305
return None;
13061306
}
13071307

1308+
if !builder.config.rust_codegen_backends.contains(&self.backend) {
1309+
return None;
1310+
}
1311+
13081312
if self.backend == "cranelift" {
13091313
if !target_supports_cranelift_backend(self.compiler.host) {
13101314
builder.info("target not supported by rustc_codegen_cranelift. skipping");
@@ -1343,12 +1347,15 @@ impl Step for CodegenBackend {
13431347
let backends_dst = PathBuf::from("lib").join(&backends_rel);
13441348

13451349
let backend_name = format!("rustc_codegen_{}", backend);
1350+
let mut found_backend = false;
13461351
for backend in fs::read_dir(&backends_src).unwrap() {
13471352
let file_name = backend.unwrap().file_name();
13481353
if file_name.to_str().unwrap().contains(&backend_name) {
13491354
tarball.add_file(backends_src.join(file_name), &backends_dst, 0o644);
1355+
found_backend = true;
13501356
}
13511357
}
1358+
assert!(found_backend);
13521359

13531360
Some(tarball.generate())
13541361
}

0 commit comments

Comments
 (0)