about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tests/ui/imports/resolve-other-libc.rs14
-rw-r--r--tests/ui/imports/resolve-other-libc.stderr8
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
+