mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 16:54:01 +00:00
Tests for bad --extern library path and file
This commit is contained in:
parent
395f2b84e6
commit
7169c7d105
@ -1026,7 +1026,6 @@ impl CrateError {
|
||||
None => String::new(),
|
||||
Some(r) => format!(" which `{}` depends on", r.name),
|
||||
};
|
||||
// FIXME: There are no tests for CrateLocationUnknownType or LibFilenameForm
|
||||
if !locator.crate_rejections.via_filename.is_empty() {
|
||||
let mismatches = locator.crate_rejections.via_filename.iter();
|
||||
for CrateMismatch { path, .. } in mismatches {
|
||||
|
8
src/test/ui/errors/issue-104621-extern-bad-file.rs
Normal file
8
src/test/ui/errors/issue-104621-extern-bad-file.rs
Normal file
@ -0,0 +1,8 @@
|
||||
// compile-flags: --extern foo={{src-base}}/errors/issue-104621-extern-bad-file.rs
|
||||
// only-linux
|
||||
|
||||
extern crate foo;
|
||||
//~^ ERROR extern location for foo is of an unknown type
|
||||
//~| ERROR file name should be lib*.rlib or lib*.so
|
||||
//~| ERROR can't find crate for `foo` [E0463]
|
||||
fn main() {}
|
21
src/test/ui/errors/issue-104621-extern-bad-file.stderr
Normal file
21
src/test/ui/errors/issue-104621-extern-bad-file.stderr
Normal file
@ -0,0 +1,21 @@
|
||||
error: extern location for foo is of an unknown type: $DIR/issue-104621-extern-bad-file.rs
|
||||
--> $DIR/issue-104621-extern-bad-file.rs:4:1
|
||||
|
|
||||
LL | extern crate foo;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: file name should be lib*.rlib or lib*.so
|
||||
--> $DIR/issue-104621-extern-bad-file.rs:4:1
|
||||
|
|
||||
LL | extern crate foo;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0463]: can't find crate for `foo`
|
||||
--> $DIR/issue-104621-extern-bad-file.rs:4:1
|
||||
|
|
||||
LL | extern crate foo;
|
||||
| ^^^^^^^^^^^^^^^^^ can't find crate
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0463`.
|
4
src/test/ui/errors/issue-104621-extern-not-file.rs
Normal file
4
src/test/ui/errors/issue-104621-extern-not-file.rs
Normal file
@ -0,0 +1,4 @@
|
||||
// compile-flags: --extern foo=.
|
||||
|
||||
extern crate foo; //~ ERROR extern location for foo is not a file: .
|
||||
fn main() {}
|
8
src/test/ui/errors/issue-104621-extern-not-file.stderr
Normal file
8
src/test/ui/errors/issue-104621-extern-not-file.stderr
Normal file
@ -0,0 +1,8 @@
|
||||
error: extern location for foo is not a file: .
|
||||
--> $DIR/issue-104621-extern-not-file.rs:3:1
|
||||
|
|
||||
LL | extern crate foo;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
Loading…
Reference in New Issue
Block a user