Ensure the rustc-codegen-cranelift-preview component is never empty · rust-lang/rust@aefd7ac (original) (raw)
File tree
1 file changed
lines changed
- src/bootstrap/src/core/build_steps
1 file changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1305,6 +1305,10 @@ impl Step for CodegenBackend { | ||
1305 | 1305 | return None; |
1306 | 1306 | } |
1307 | 1307 | |
1308 | +if !builder.config.rust_codegen_backends.contains(&self.backend) { | |
1309 | +return None; | |
1310 | +} | |
1311 | + | |
1308 | 1312 | if self.backend == "cranelift" { |
1309 | 1313 | if !target_supports_cranelift_backend(self.compiler.host) { |
1310 | 1314 | builder.info("target not supported by rustc_codegen_cranelift. skipping"); |
@@ -1343,12 +1347,15 @@ impl Step for CodegenBackend { | ||
1343 | 1347 | let backends_dst = PathBuf::from("lib").join(&backends_rel); |
1344 | 1348 | |
1345 | 1349 | let backend_name = format!("rustc_codegen_{}", backend); |
1350 | +let mut found_backend = false; | |
1346 | 1351 | for backend in fs::read_dir(&backends_src).unwrap() { |
1347 | 1352 | let file_name = backend.unwrap().file_name(); |
1348 | 1353 | if file_name.to_str().unwrap().contains(&backend_name) { |
1349 | 1354 | tarball.add_file(backends_src.join(file_name), &backends_dst, 0o644); |
1355 | + found_backend = true; | |
1350 | 1356 | } |
1351 | 1357 | } |
1358 | +assert!(found_backend); | |
1352 | 1359 | |
1353 | 1360 | Some(tarball.generate()) |
1354 | 1361 | } |