2024-09-16 14:48:47 +08:00
|
|
|
// Crates that are resolved normally have their path canonicalized and all symlinks resolved. This
|
|
|
|
// did not happen for paths specified using the `--extern` option to rustc, which could lead to
|
|
|
|
// rustc thinking that it encountered two different versions of a crate, when it's actually the same
|
|
|
|
// version found through different paths.
|
|
|
|
//
|
|
|
|
// This test checks that `--extern` and symlinks together can result in successful compilation.
|
|
|
|
//
|
|
|
|
// See <https://github.com/rust-lang/rust/pull/16505>.
|
2024-05-28 13:21:28 -04:00
|
|
|
|
|
|
|
//@ ignore-cross-compile
|
2024-06-23 13:42:52 +00:00
|
|
|
//@ needs-symlink
|
2024-05-28 13:21:28 -04:00
|
|
|
|
2024-09-16 14:48:47 +08:00
|
|
|
use run_make_support::{cwd, path, rfs, rustc};
|
2024-05-28 13:21:28 -04:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
rustc().input("foo.rs").run();
|
2024-07-17 12:42:06 +00:00
|
|
|
rfs::create_dir_all("other");
|
2024-09-16 14:48:47 +08:00
|
|
|
rfs::symlink_file(path("libfoo.rlib"), path("other").join("libfoo.rlib"));
|
|
|
|
|
2024-05-28 13:57:09 -04:00
|
|
|
rustc().input("bar.rs").library_search_path(cwd()).run();
|
2024-09-16 14:48:47 +08:00
|
|
|
rustc().input("baz.rs").extern_("foo", "other/libfoo.rlib").library_search_path(cwd()).run();
|
2024-05-28 13:21:28 -04:00
|
|
|
}
|