Skip to content

Commit f377ea1

Browse files
committed
rewrite issue-30063
1 parent 60faa27 commit f377ea1

File tree

4 files changed

+38
-37
lines changed

4 files changed

+38
-37
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ run-make/issue-25581/Makefile
103103
run-make/issue-26006/Makefile
104104
run-make/issue-26092/Makefile
105105
run-make/issue-28595/Makefile
106-
run-make/issue-30063/Makefile
107106
run-make/issue-33329/Makefile
108107
run-make/issue-35164/Makefile
109108
run-make/issue-36710/Makefile

tests/run-make/issue-30063/Makefile

-36
This file was deleted.
File renamed without changes.
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// When rustc received 4 codegen-units, an output path and an emit flag all simultaneously,
2+
// this could cause an annoying recompilation issue, uselessly lengthening the build process.
3+
// A fix was delivered, which resets codegen-units to 1 when necessary,
4+
// but as it directly affected the way codegen-units are manipulated,
5+
// this test was created to check that this fix did not cause compilation failures.
6+
// See https://github.com/rust-lang/rust/issues/30063
7+
8+
//@ ignore-cross-compile
9+
10+
use run_make_support::{rustc, tmp_dir};
11+
use std::fs;
12+
13+
fn compile(output_file: &str, emit: Option<&str>) {
14+
let mut rustc = rustc();
15+
let rustc = rustc.codegen_units(4).output(tmp_dir().join(output_file)).input("foo.rs");
16+
if let Some(emit) = emit {
17+
rustc.emit(emit);
18+
}
19+
rustc.run();
20+
}
21+
22+
fn main() {
23+
let flags = [
24+
("foo-output", None),
25+
("asm-output", Some("asm")),
26+
("bc-output", Some("llvm-bc")),
27+
("ir-output", Some("llvm-ir")),
28+
("link-output", Some("link")),
29+
("obj-output", Some("obj")),
30+
("dep-output", Some("dep-info")),
31+
("multi-output", Some("asm,obj")),
32+
];
33+
for (output_file, emit) in flags {
34+
fs::remove_file(output_file).unwrap_or_default();
35+
compile(output_file, emit);
36+
fs::remove_file(output_file);
37+
}
38+
}

0 commit comments

Comments
 (0)