Skip to content

Commit

Permalink
Rollup merge of rust-lang#114166 - Enselic:libc-unavailable, r=Nilstrieb
Browse files Browse the repository at this point in the history
Add regression test for resolving `--extern libc=test.rlib`

Closes rust-lang#26043

I could not find a test for this particular use case. The closest I got was [`tests/ui/imports/issue-37887.rs`](https://github.com/rust-lang/rust/blob/master/tests/ui/imports/issue-37887.rs), but that is a regression test for a different use case (see rust-lang#37887).
  • Loading branch information
Noratrieb authored Aug 2, 2023
2 parents 46f6b05 + 7dd5e3c commit ddda3fa
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/ui/imports/resolve-other-libc.rs
Original file line number Diff line number Diff line change
@@ -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() {}
8 changes: 8 additions & 0 deletions tests/ui/imports/resolve-other-libc.stderr
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ddda3fa

Please sign in to comment.