diff options
| author | Martin Nordholts <enselic@gmail.com> | 2023-07-28 11:31:31 +0200 |
|---|---|---|
| committer | Martin Nordholts <enselic@gmail.com> | 2023-07-29 08:51:17 +0200 |
| commit | 7dd5e3c1cd5c150f16261fef6a1efb76e70f022e (patch) | |
| tree | f6b68e30178b2997a9c730a373fa26ac6859ff1e | |
| parent | a6236fa460811bbd4a08a94db249c344fa9f2220 (diff) | |
| download | rust-7dd5e3c1cd5c150f16261fef6a1efb76e70f022e.tar.gz rust-7dd5e3c1cd5c150f16261fef6a1efb76e70f022e.zip | |
Add regression test for resolving `--extern libc=test.rlib`
I could not find a test for this particular use case. The closest I got was `tests/ui/imports/issue-37887.rs`, but that is a regression test for a different use case.
| -rw-r--r-- | tests/ui/imports/resolve-other-libc.rs | 14 | ||||
| -rw-r--r-- | tests/ui/imports/resolve-other-libc.stderr | 8 |
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/imports/resolve-other-libc.rs b/tests/ui/imports/resolve-other-libc.rs new file mode 100644 index 00000000000..806d854ec89 --- /dev/null +++ b/tests/ui/imports/resolve-other-libc.rs @@ -0,0 +1,14 @@ +// Regression test for https://github.com/rust-lang/rust/issues/26043 + +// compile-flags: --extern libc=test.rlib + +// The error shall NOT be something similar to the following, because it +// indicates that `libc` was wrongly resolved to `libc` shipped with the +// compiler: +// +// error[E0658]: use of unstable library feature 'rustc_private': \ +// this crate is being loaded from the sysroot +// +extern crate libc; //~ ERROR: extern location for libc does not exist: test.rlib + +fn main() {} diff --git a/tests/ui/imports/resolve-other-libc.stderr b/tests/ui/imports/resolve-other-libc.stderr new file mode 100644 index 00000000000..e57b88e50c6 --- /dev/null +++ b/tests/ui/imports/resolve-other-libc.stderr @@ -0,0 +1,8 @@ +error: extern location for libc does not exist: test.rlib + --> $DIR/resolve-other-libc.rs:12:1 + | +LL | extern crate libc; + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + |
