Skip to content

Commit a3b7c29

Browse files
committed
rewrite extern-flag-fun to rmake
1 parent 7ac6c2f commit a3b7c29

File tree

3 files changed

+36
-21
lines changed

3 files changed

+36
-21
lines changed

Diff for: src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ run-make/error-writing-dependencies/Makefile
4343
run-make/export-executable-symbols/Makefile
4444
run-make/extern-diff-internal-name/Makefile
4545
run-make/extern-flag-disambiguates/Makefile
46-
run-make/extern-flag-fun/Makefile
4746
run-make/extern-flag-pathless/Makefile
4847
run-make/extern-flag-rename-transitive/Makefile
4948
run-make/extern-fn-explicit-align/Makefile

Diff for: tests/run-make/extern-flag-fun/Makefile

-20
This file was deleted.

Diff for: tests/run-make/extern-flag-fun/rmake.rs

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// The --extern flag can override the default crate search of
2+
// the compiler and directly fetch a given path. There are a few rules
3+
// to follow: for example, there can't be more than one rlib, the crates must
4+
// be valid ("no-exist" in this test), and private crates can't be loaded
5+
// as non-private. This test checks that these rules are enforced.
6+
// See https://github.com/rust-lang/rust/pull/15319
7+
8+
//@ ignore-cross-compile
9+
10+
use run_make_support::{rust_lib_name, rustc};
11+
12+
fn main() {
13+
rustc().input("bar.rs").crate_type("rlib").run();
14+
rustc().input("bar.rs").crate_type("rlib").extra_filename("-a").run();
15+
rustc().input("bar-alt.rs").crate_type("rlib").run();
16+
rustc().input("foo.rs").extern_("bar", "no-exist").run_fail();
17+
rustc().input("foo.rs").extern_("bar", "foo.rs").run_fail();
18+
rustc()
19+
.input("foo.rs")
20+
.extern_("bar", rust_lib_name("bar"))
21+
.extern_("bar", rust_lib_name("bar-alt"))
22+
.run_fail();
23+
rustc()
24+
.input("foo.rs")
25+
.extern_("bar", rust_lib_name("bar"))
26+
.extern_("bar", rust_lib_name("bar-a"))
27+
.run();
28+
rustc().input("foo.rs").extern_("bar", rust_lib_name("bar")).run();
29+
// Try to be sneaky and load a private crate from with a non-private name.
30+
rustc().input("rustc.rs").arg("-Zforce-unstable-if-unmarked").crate_type("rlib").run();
31+
rustc()
32+
.input("gated_unstable.rs")
33+
.extern_("alloc", rust_lib_name("rustc"))
34+
.run_fail()
35+
.assert_stderr_contains("rustc_private");
36+
}

0 commit comments

Comments
 (0)