-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add suggestion to the "missing native library" error
If we fail to locate a native library that we are linking with, it could be the case the user entered a complete file name like `foo.lib` or `libfoo.a` when we expect them to simply provide `foo`. In this situation, we now detect that case and suggest the user only provide the library name itself.
- Loading branch information
1 parent
0938e16
commit 097b6d3
Showing
7 changed files
with
68 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/test/ui/native-library-link-flags/suggest-libname-only-1.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// build-fail | ||
// compile-flags: --crate-type rlib | ||
// error-pattern: could not find native static library `libfoo.a` | ||
// error-pattern: only provide the library name `foo`, not the full filename | ||
|
||
#[link(name = "libfoo.a", kind = "static")] | ||
extern { } | ||
|
||
pub fn main() { } |
6 changes: 6 additions & 0 deletions
6
src/test/ui/native-library-link-flags/suggest-libname-only-1.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
error: could not find native static library `libfoo.a`, perhaps an -L flag is missing? | ||
| | ||
= help: only provide the library name `foo`, not the full filename | ||
|
||
error: aborting due to previous error | ||
|
9 changes: 9 additions & 0 deletions
9
src/test/ui/native-library-link-flags/suggest-libname-only-2.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// build-fail | ||
// compile-flags: --crate-type rlib | ||
// error-pattern: could not find native static library `bar.lib` | ||
// error-pattern: only provide the library name `bar`, not the full filename | ||
|
||
#[link(name = "bar.lib", kind = "static")] | ||
extern { } | ||
|
||
pub fn main() { } |
6 changes: 6 additions & 0 deletions
6
src/test/ui/native-library-link-flags/suggest-libname-only-2.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
error: could not find native static library `bar.lib`, perhaps an -L flag is missing? | ||
| | ||
= help: only provide the library name `bar`, not the full filename | ||
|
||
error: aborting due to previous error | ||
|