rewrite issue-30063

This commit is contained in:
Oneirical 2024-05-17 16:50:37 -04:00
parent 60faa271d9
commit f377ea165f
4 changed files with 38 additions and 37 deletions

View File

@ -103,7 +103,6 @@ run-make/issue-25581/Makefile
run-make/issue-26006/Makefile run-make/issue-26006/Makefile
run-make/issue-26092/Makefile run-make/issue-26092/Makefile
run-make/issue-28595/Makefile run-make/issue-28595/Makefile
run-make/issue-30063/Makefile
run-make/issue-33329/Makefile run-make/issue-33329/Makefile
run-make/issue-35164/Makefile run-make/issue-35164/Makefile
run-make/issue-36710/Makefile run-make/issue-36710/Makefile

View File

@ -1,36 +0,0 @@
# ignore-cross-compile
include ../tools.mk
all:
rm -f $(TMPDIR)/foo-output
$(RUSTC) -C codegen-units=4 -o $(TMPDIR)/foo-output foo.rs
rm $(TMPDIR)/foo-output
rm -f $(TMPDIR)/asm-output
$(RUSTC) -C codegen-units=4 --emit=asm -o $(TMPDIR)/asm-output foo.rs
rm $(TMPDIR)/asm-output
rm -f $(TMPDIR)/bc-output
$(RUSTC) -C codegen-units=4 --emit=llvm-bc -o $(TMPDIR)/bc-output foo.rs
rm $(TMPDIR)/bc-output
rm -f $(TMPDIR)/ir-output
$(RUSTC) -C codegen-units=4 --emit=llvm-ir -o $(TMPDIR)/ir-output foo.rs
rm $(TMPDIR)/ir-output
rm -f $(TMPDIR)/link-output
$(RUSTC) -C codegen-units=4 --emit=link -o $(TMPDIR)/link-output foo.rs
rm $(TMPDIR)/link-output
rm -f $(TMPDIR)/obj-output
$(RUSTC) -C codegen-units=4 --emit=obj -o $(TMPDIR)/obj-output foo.rs
rm $(TMPDIR)/obj-output
rm -f $(TMPDIR)/dep-output
$(RUSTC) -C codegen-units=4 --emit=dep-info -o $(TMPDIR)/dep-output foo.rs
rm $(TMPDIR)/dep-output
# # (This case doesn't work yet, and may be fundamentally wrong-headed anyway.)
# rm -f $(TMPDIR)/multi-output
# $(RUSTC) -C codegen-units=4 --emit=asm,obj -o $(TMPDIR)/multi-output foo.rs
# rm $(TMPDIR)/multi-output

View File

@ -0,0 +1,38 @@
// 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
use run_make_support::{rustc, tmp_dir};
use std::fs;
fn compile(output_file: &str, emit: Option<&str>) {
let mut rustc = rustc();
let rustc = rustc.codegen_units(4).output(tmp_dir().join(output_file)).input("foo.rs");
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")),
("multi-output", Some("asm,obj")),
];
for (output_file, emit) in flags {
fs::remove_file(output_file).unwrap_or_default();
compile(output_file, emit);
fs::remove_file(output_file);
}
}