Auto merge of #128102 - Oneirical:real-testate, r=Kobzol · rust-lang/rust@54be9ad (original) (raw)
File tree
7 files changed
lines changed
- extern-diff-internal-name
7 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -13,11 +13,8 @@ run-make/dep-info/Makefile | ||
13 | 13 | run-make/dump-ice-to-disk/Makefile |
14 | 14 | run-make/emit-to-stdout/Makefile |
15 | 15 | run-make/export-executable-symbols/Makefile |
16 | -run-make/extern-diff-internal-name/Makefile | |
17 | 16 | run-make/extern-flag-disambiguates/Makefile |
18 | 17 | run-make/extern-fn-reachable/Makefile |
19 | -run-make/extern-multiple-copies/Makefile | |
20 | -run-make/extern-multiple-copies2/Makefile | |
21 | 18 | run-make/fmt-write-bloat/Makefile |
22 | 19 | run-make/foreign-double-unwind/Makefile |
23 | 20 | run-make/foreign-exceptions/Makefile |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
1 | +// In the following scenario: | |
2 | +// 1. The crate foo, is referenced multiple times | |
3 | +// 2. --extern foo=./path/to/libbar.rlib is specified to rustc | |
4 | +// 3. The internal crate name of libbar.rlib is not foo | |
5 | +// Compilation fails with the "multiple crate versions" error message. | |
6 | +// As this was fixed in #17189, this regression test ensures this bug does not | |
7 | +// make a resurgence. | |
8 | +// See https://github.com/rust-lang/rust/pull/17189 | |
9 | + | |
10 | +use run_make_support::{rust_lib_name, rustc}; | |
11 | + | |
12 | +fn main() { | |
13 | +rustc().input("lib.rs").run(); | |
14 | +rustc().input("test.rs").extern_("foo", rust_lib_name("bar")).run(); | |
15 | +} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
1 | +// In this test, the rust library foo1 exists in two different locations, but only one | |
2 | +// is required by the --extern flag. This test checks that the copy is ignored (as --extern | |
3 | +// demands fetching only the original instance of foo1) and that no error is emitted, resulting | |
4 | +// in successful compilation. | |
5 | +// https://github.com/rust-lang/rust/pull/29961 | |
6 | + | |
7 | +use run_make_support::{path, rfs, rust_lib_name, rustc}; | |
8 | + | |
9 | +fn main() { | |
10 | +rustc().input("foo1.rs").run(); | |
11 | +rustc().input("foo2.rs").run(); | |
12 | + rfs::create_dir("foo"); | |
13 | + rfs::copy(rust_lib_name("foo1"), path("foo").join(rust_lib_name("foo1"))); | |
14 | +rustc().input("bar.rs").extern_("foo1", rust_lib_name("foo1")).library_search_path("foo").run(); | |
15 | +} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
1 | +// Almost identical to `extern-multiple-copies`, but with a variation in the --extern calls | |
2 | +// and the addition of #[macro_use] in the rust code files, which used to break --extern | |
3 | +// until #33625. | |
4 | +// In this test, the rust library foo1 exists in two different locations, but only one | |
5 | +// is required by the --extern flag. This test checks that the copy is ignored (as --extern | |
6 | +// demands fetching only the original instance of foo1) and that no error is emitted, resulting | |
7 | +// in successful compilation. | |
8 | +// https://github.com/rust-lang/rust/issues/33762 | |
9 | + | |
10 | +use run_make_support::{path, rfs, rust_lib_name, rustc}; | |
11 | + | |
12 | +fn main() { | |
13 | +rustc().input("foo1.rs").run(); | |
14 | +rustc().input("foo2.rs").run(); | |
15 | + rfs::create_dir("foo"); | |
16 | + rfs::copy(rust_lib_name("foo1"), path("foo").join(rust_lib_name("foo1"))); | |
17 | +rustc() | |
18 | +.input("bar.rs") | |
19 | +.extern_("foo1", path("foo").join(rust_lib_name("foo1"))) | |
20 | +.extern_("foo2", rust_lib_name("foo2")) | |
21 | +.run(); | |
22 | +} |