Skip to content

Commit

Permalink
rewrite extern-flag-fun to rmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Oneirical committed Jun 14, 2024
1 parent 7ac6c2f commit a3b7c29
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 21 deletions.
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ run-make/error-writing-dependencies/Makefile
run-make/export-executable-symbols/Makefile
run-make/extern-diff-internal-name/Makefile
run-make/extern-flag-disambiguates/Makefile
run-make/extern-flag-fun/Makefile
run-make/extern-flag-pathless/Makefile
run-make/extern-flag-rename-transitive/Makefile
run-make/extern-fn-explicit-align/Makefile
Expand Down
20 changes: 0 additions & 20 deletions tests/run-make/extern-flag-fun/Makefile

This file was deleted.

36 changes: 36 additions & 0 deletions tests/run-make/extern-flag-fun/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// The --extern flag can override the default crate search of
// the compiler and directly fetch a given path. There are a few rules
// to follow: for example, there can't be more than one rlib, the crates must
// be valid ("no-exist" in this test), and private crates can't be loaded
// as non-private. This test checks that these rules are enforced.
// See https://github.com/rust-lang/rust/pull/15319

//@ ignore-cross-compile

use run_make_support::{rust_lib_name, rustc};

fn main() {
rustc().input("bar.rs").crate_type("rlib").run();
rustc().input("bar.rs").crate_type("rlib").extra_filename("-a").run();
rustc().input("bar-alt.rs").crate_type("rlib").run();
rustc().input("foo.rs").extern_("bar", "no-exist").run_fail();
rustc().input("foo.rs").extern_("bar", "foo.rs").run_fail();
rustc()
.input("foo.rs")
.extern_("bar", rust_lib_name("bar"))
.extern_("bar", rust_lib_name("bar-alt"))
.run_fail();
rustc()
.input("foo.rs")
.extern_("bar", rust_lib_name("bar"))
.extern_("bar", rust_lib_name("bar-a"))
.run();
rustc().input("foo.rs").extern_("bar", rust_lib_name("bar")).run();
// Try to be sneaky and load a private crate from with a non-private name.
rustc().input("rustc.rs").arg("-Zforce-unstable-if-unmarked").crate_type("rlib").run();
rustc()
.input("gated_unstable.rs")
.extern_("alloc", rust_lib_name("rustc"))
.run_fail()
.assert_stderr_contains("rustc_private");
}

0 comments on commit a3b7c29

Please sign in to comment.