2024-05-17 15:50:37 -05:00
|
|
|
// When rustc received 4 codegen-units, an output path and an emit flag all simultaneously,
|
|
|
|
// this could cause an annoying recompilation issue, uselessly lengthening the build process.
|
|
|
|
// A fix was delivered, which resets codegen-units to 1 when necessary,
|
|
|
|
// but as it directly affected the way codegen-units are manipulated,
|
|
|
|
// this test was created to check that this fix did not cause compilation failures.
|
|
|
|
// See https://github.com/rust-lang/rust/issues/30063
|
|
|
|
|
|
|
|
//@ ignore-cross-compile
|
|
|
|
|
2024-08-28 10:01:40 -05:00
|
|
|
use run_make_support::{bin_name, path, rustc};
|
2024-07-28 17:13:50 -05:00
|
|
|
|
2024-05-17 15:50:37 -05:00
|
|
|
fn compile(output_file: &str, emit: Option<&str>) {
|
|
|
|
let mut rustc = rustc();
|
2024-06-06 14:34:34 -05:00
|
|
|
let rustc = rustc.codegen_units(4).output(output_file).input("foo.rs");
|
2024-05-17 15:50:37 -05:00
|
|
|
if let Some(emit) = emit {
|
|
|
|
rustc.emit(emit);
|
|
|
|
}
|
|
|
|
rustc.run();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let flags = [
|
|
|
|
("foo-output", None),
|
|
|
|
("asm-output", Some("asm")),
|
|
|
|
("bc-output", Some("llvm-bc")),
|
|
|
|
("ir-output", Some("llvm-ir")),
|
|
|
|
("link-output", Some("link")),
|
|
|
|
("obj-output", Some("obj")),
|
|
|
|
("dep-output", Some("dep-info")),
|
|
|
|
];
|
|
|
|
for (output_file, emit) in flags {
|
2024-06-06 13:47:00 -05:00
|
|
|
// In the None case, bin_name is required for successful Windows compilation.
|
|
|
|
let output_file = &bin_name(output_file);
|
2024-05-17 15:50:37 -05:00
|
|
|
compile(output_file, emit);
|
2024-08-28 10:01:40 -05:00
|
|
|
assert!(path(output_file).is_file());
|
2024-05-17 15:50:37 -05:00
|
|
|
}
|
2024-06-06 13:47:00 -05:00
|
|
|
|
|
|
|
compile("multi-output", Some("asm,obj"));
|
2024-08-28 10:01:40 -05:00
|
|
|
assert!(path("multi-output.s").is_file());
|
|
|
|
assert!(path("multi-output.o").is_file());
|
2024-05-17 15:50:37 -05:00
|
|
|
}
|