Rollup merge of #125227 - Oneirical:seventh, r=jieyouxu

Migrate `run-make/issue-30063` to `rmake`

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

(Sorry about the [inconvenience](https://github.com/rust-lang/rust/pull/125224#issuecomment-2118340932) of all these PRs, this is the last one batched for today. I will discuss how we can cut these down a bit.)

The last check was previously commented out in the Makefile, and I have readded it. If it fails the CI, this can be reconsidered.
This commit is contained in:
León Orell Valerian Liehr 2024-05-23 20:09:09 +02:00 committed by GitHub
commit d392d6849c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 38 additions and 37 deletions

View File

@ -101,7 +101,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);
}
}