Skip to content

Commit 0e7d077

Browse files
committed
Rewrite link-arg in rmake.rs
1 parent 4649877 commit 0e7d077

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ run-make/libtest-json/Makefile
127127
run-make/libtest-junit/Makefile
128128
run-make/libtest-padding/Makefile
129129
run-make/libtest-thread-limit/Makefile
130-
run-make/link-arg/Makefile
131130
run-make/link-args-order/Makefile
132131
run-make/link-cfg/Makefile
133132
run-make/link-dedup/Makefile

tests/run-make/link-arg/Makefile

-5
This file was deleted.

tests/run-make/link-arg/rmake.rs

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// In 2016, the rustc flag "-C link-arg" was introduced - it can be repeatedly used
2+
// to add single arguments to the linker. This test passes 2 arguments to the linker using it,
3+
// then checks that the compiler's output contains the arguments passed to it.
4+
// This ensures that the compiler successfully parses this flag.
5+
// See https://github.com/rust-lang/rust/pull/36574
6+
7+
use run_make_support::rustc;
8+
9+
fn main() {
10+
let output = String::from_utf8(
11+
rustc()
12+
.input("empty.rs")
13+
.link_arg("-lfoo")
14+
.link_arg("-lbar")
15+
.print("link-args")
16+
.command_output()
17+
.stdout,
18+
)
19+
.unwrap();
20+
assert!(
21+
output.contains("lfoo") || output.contains("lbar"),
22+
"The output did not contain the expected \"lfoo\" or \"lbar\" strings."
23+
);
24+
}

0 commit comments

Comments
 (0)