-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #96885 - petrochenkov:linkstrict2, r=cjgillot,luqmana
rustc: Stricter checking for #[link] attributes A subset of #94962 that doesn't touch library renaming/reordering/deduplication. `#[link]` attributes are checked for all kinds of unexpected arguments inside them. I also tried to make wording for these errors more consistent, that's why some existing errors are changed, including errors for command line `-l` options. Spans are also made more precise where possible.
Showing
61 changed files
with
774 additions
and
535 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ Please specify a valid "kind" value, from one of the following: | |
* static | ||
* dylib | ||
* framework | ||
* raw-dylib |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#[link(name = "")] //~ ERROR: given with empty name | ||
#[link(name = "")] //~ ERROR: link name must not be empty | ||
extern "C" {} | ||
|
||
fn main() {} |
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
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
4 changes: 2 additions & 2 deletions
4
src/test/ui/feature-gates/feature-gate-native_link_modifiers_as_needed.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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#[link(name = "foo", modifiers = "+as-needed")] | ||
//~^ ERROR: `#[link(modifiers="as-needed")]` is unstable | ||
#[link(name = "foo", kind = "dylib", modifiers = "+as-needed")] | ||
//~^ ERROR: linking modifier `as-needed` is unstable | ||
extern "C" {} | ||
|
||
fn main() {} |
8 changes: 4 additions & 4 deletions
8
src/test/ui/feature-gates/feature-gate-native_link_modifiers_as_needed.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
2 changes: 1 addition & 1 deletion
2
src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-3.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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
error: bundle linking modifier is currently unstable and only accepted on the nightly compiler | ||
error: linking modifier `bundle` is unstable and only accepted on the nightly compiler | ||
|
4 changes: 2 additions & 2 deletions
4
src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle.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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#[link(name = "foo", modifiers = "+bundle")] | ||
//~^ ERROR: `#[link(modifiers="bundle")]` is unstable | ||
#[link(name = "foo", kind = "static", modifiers = "+bundle")] | ||
//~^ ERROR: linking modifier `bundle` is unstable | ||
extern "C" {} | ||
|
||
fn main() {} |
8 changes: 4 additions & 4 deletions
8
src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle.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
2 changes: 1 addition & 1 deletion
2
src/test/ui/feature-gates/feature-gate-native_link_modifiers_verbatim.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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#[link(name = "foo", modifiers = "+verbatim")] | ||
//~^ ERROR: `#[link(modifiers="verbatim")]` is unstable | ||
//~^ ERROR: linking modifier `verbatim` is unstable | ||
extern "C" {} | ||
|
||
fn main() {} |
2 changes: 1 addition & 1 deletion
2
src/test/ui/feature-gates/feature-gate-native_link_modifiers_verbatim.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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// only-windows | ||
#[link(name = "foo", kind = "raw-dylib")] | ||
//~^ ERROR: kind="raw-dylib" is unstable | ||
//~^ ERROR: link kind `raw-dylib` is unstable | ||
extern "C" {} | ||
|
||
fn main() {} |
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
2 changes: 1 addition & 1 deletion
2
src/test/ui/feature-gates/feature-gate-static-nobundle-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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
warning: library kind `static-nobundle` has been superseded by specifying `-bundle` on library kind `static`. Try `static:-bundle` | ||
warning: library kind `static-nobundle` has been superseded by specifying modifier `-bundle` with library kind `static`. Try `static:-bundle` | ||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#[link(name = "foo", kind = "static-nobundle")] | ||
//~^ WARNING: library kind `static-nobundle` has been superseded by specifying modifier `-bundle` with library kind `static` | ||
//~^^ ERROR: kind="static-nobundle" is unstable | ||
//~^ WARNING: link kind `static-nobundle` has been superseded by specifying modifier `-bundle` with link kind `static` | ||
//~^^ ERROR: link kind `static-nobundle` is unstable | ||
extern "C" {} | ||
|
||
fn main() {} |
12 changes: 6 additions & 6 deletions
12
src/test/ui/feature-gates/feature-gate-static-nobundle.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
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
128 changes: 68 additions & 60 deletions
128
src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#[link(name = "foo", cfg("rlib"))] //~ ERROR invalid argument for `cfg(..)` | ||
#[link(name = "foo", cfg("rlib"))] //~ ERROR link cfg must have a single predicate argument | ||
extern "C" {} | ||
|
||
fn main() {} |
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
error: invalid argument for `cfg(..)` | ||
--> $DIR/issue-43925.rs:1:26 | ||
error: link cfg must have a single predicate argument | ||
--> $DIR/issue-43925.rs:1:22 | ||
| | ||
LL | #[link(name = "foo", cfg("rlib"))] | ||
| ^^^^^^ | ||
| ^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#[link(name = "foo", cfg())] //~ ERROR `cfg()` must have an argument | ||
#[link(name = "foo", cfg())] //~ ERROR link cfg must have a single predicate argument | ||
extern "C" {} | ||
|
||
fn main() {} |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,8 @@ | ||
// Top-level ill-formed | ||
#[link] //~ ERROR attribute must be of the form | ||
//~| WARN this was previously accepted | ||
#[link = "foo"] //~ ERROR attribute must be of the form | ||
//~| WARN this was previously accepted | ||
extern "C" {} | ||
|
||
fn main() {} |
21 changes: 21 additions & 0 deletions
21
src/test/ui/linkage-attr/link-attr-validation-early.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,21 @@ | ||
error: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ wasm_import_module = "...")]` | ||
--> $DIR/link-attr-validation-early.rs:2:1 | ||
| | ||
LL | #[link] | ||
| ^^^^^^^ | ||
| | ||
= note: `#[deny(ill_formed_attribute_input)]` on by default | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571> | ||
|
||
error: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ wasm_import_module = "...")]` | ||
--> $DIR/link-attr-validation-early.rs:4:1 | ||
| | ||
LL | #[link = "foo"] | ||
| ^^^^^^^^^^^^^^^ | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571> | ||
|
||
error: aborting due to 2 previous errors | ||
|
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,40 @@ | ||
#![feature(native_link_modifiers_verbatim)] | ||
#![feature(link_cfg)] | ||
|
||
// Top-level ill-formed | ||
#[link(name = "...", "literal")] //~ ERROR unexpected `#[link]` argument | ||
#[link(name = "...", unknown)] //~ ERROR unexpected `#[link]` argument | ||
extern "C" {} | ||
|
||
// Duplicate arguments | ||
#[link(name = "foo", name = "bar")] //~ ERROR multiple `name` arguments | ||
#[link(name = "...", kind = "dylib", kind = "bar")] //~ ERROR multiple `kind` arguments | ||
#[link(name = "...", modifiers = "+verbatim", modifiers = "bar")] //~ ERROR multiple `modifiers` arguments | ||
#[link(name = "...", cfg(FALSE), cfg(FALSE))] //~ ERROR multiple `cfg` arguments | ||
#[link(wasm_import_module = "foo", wasm_import_module = "bar")] //~ ERROR multiple `wasm_import_module` arguments | ||
extern "C" {} | ||
|
||
// Ill-formed arguments | ||
#[link(name)] //~ ERROR link name must be of the form `name = "string"` | ||
//~| ERROR `#[link]` attribute requires a `name = "string"` argument | ||
#[link(name())] //~ ERROR link name must be of the form `name = "string"` | ||
//~| ERROR `#[link]` attribute requires a `name = "string"` argument | ||
#[link(name = "...", kind)] //~ ERROR link kind must be of the form `kind = "string"` | ||
#[link(name = "...", kind())] //~ ERROR link kind must be of the form `kind = "string"` | ||
#[link(name = "...", modifiers)] //~ ERROR link modifiers must be of the form `modifiers = "string"` | ||
#[link(name = "...", modifiers())] //~ ERROR link modifiers must be of the form `modifiers = "string"` | ||
#[link(name = "...", cfg)] //~ ERROR link cfg must be of the form `cfg(/* predicate */)` | ||
#[link(name = "...", cfg = "literal")] //~ ERROR link cfg must be of the form `cfg(/* predicate */)` | ||
#[link(name = "...", cfg("literal"))] //~ ERROR link cfg must have a single predicate argument | ||
#[link(name = "...", wasm_import_module)] //~ ERROR wasm import module must be of the form `wasm_import_module = "string"` | ||
#[link(name = "...", wasm_import_module())] //~ ERROR wasm import module must be of the form `wasm_import_module = "string"` | ||
extern "C" {} | ||
|
||
// Basic modifier validation | ||
#[link(name = "...", modifiers = "")] //~ ERROR invalid linking modifier syntax, expected '+' or '-' prefix | ||
#[link(name = "...", modifiers = "no-plus-minus")] //~ ERROR invalid linking modifier syntax, expected '+' or '-' prefix | ||
#[link(name = "...", modifiers = "+unknown")] //~ ERROR unknown linking modifier `unknown` | ||
#[link(name = "...", modifiers = "+verbatim,+verbatim")] //~ ERROR multiple `verbatim` modifiers | ||
extern "C" {} | ||
|
||
fn main() {} |
147 changes: 147 additions & 0 deletions
147
src/test/ui/linkage-attr/link-attr-validation-late.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,147 @@ | ||
error: unexpected `#[link]` argument, expected one of: name, kind, modifiers, cfg, wasm_import_module | ||
--> $DIR/link-attr-validation-late.rs:5:22 | ||
| | ||
LL | #[link(name = "...", "literal")] | ||
| ^^^^^^^^^ | ||
|
||
error: unexpected `#[link]` argument, expected one of: name, kind, modifiers, cfg, wasm_import_module | ||
--> $DIR/link-attr-validation-late.rs:6:22 | ||
| | ||
LL | #[link(name = "...", unknown)] | ||
| ^^^^^^^ | ||
|
||
error: multiple `name` arguments in a single `#[link]` attribute | ||
--> $DIR/link-attr-validation-late.rs:10:22 | ||
| | ||
LL | #[link(name = "foo", name = "bar")] | ||
| ^^^^^^^^^^^^ | ||
|
||
error: multiple `kind` arguments in a single `#[link]` attribute | ||
--> $DIR/link-attr-validation-late.rs:11:38 | ||
| | ||
LL | #[link(name = "...", kind = "dylib", kind = "bar")] | ||
| ^^^^^^^^^^^^ | ||
|
||
error: multiple `modifiers` arguments in a single `#[link]` attribute | ||
--> $DIR/link-attr-validation-late.rs:12:47 | ||
| | ||
LL | #[link(name = "...", modifiers = "+verbatim", modifiers = "bar")] | ||
| ^^^^^^^^^^^^^^^^^ | ||
|
||
error: multiple `cfg` arguments in a single `#[link]` attribute | ||
--> $DIR/link-attr-validation-late.rs:13:34 | ||
| | ||
LL | #[link(name = "...", cfg(FALSE), cfg(FALSE))] | ||
| ^^^^^^^^^^ | ||
|
||
error: multiple `wasm_import_module` arguments in a single `#[link]` attribute | ||
--> $DIR/link-attr-validation-late.rs:14:36 | ||
| | ||
LL | #[link(wasm_import_module = "foo", wasm_import_module = "bar")] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: link name must be of the form `name = "string"` | ||
--> $DIR/link-attr-validation-late.rs:18:8 | ||
| | ||
LL | #[link(name)] | ||
| ^^^^ | ||
|
||
error[E0459]: `#[link]` attribute requires a `name = "string"` argument | ||
--> $DIR/link-attr-validation-late.rs:18:1 | ||
| | ||
LL | #[link(name)] | ||
| ^^^^^^^^^^^^^ missing `name` argument | ||
|
||
error: link name must be of the form `name = "string"` | ||
--> $DIR/link-attr-validation-late.rs:20:8 | ||
| | ||
LL | #[link(name())] | ||
| ^^^^^^ | ||
|
||
error[E0459]: `#[link]` attribute requires a `name = "string"` argument | ||
--> $DIR/link-attr-validation-late.rs:20:1 | ||
| | ||
LL | #[link(name())] | ||
| ^^^^^^^^^^^^^^^ missing `name` argument | ||
|
||
error: link kind must be of the form `kind = "string"` | ||
--> $DIR/link-attr-validation-late.rs:22:22 | ||
| | ||
LL | #[link(name = "...", kind)] | ||
| ^^^^ | ||
|
||
error: link kind must be of the form `kind = "string"` | ||
--> $DIR/link-attr-validation-late.rs:23:22 | ||
| | ||
LL | #[link(name = "...", kind())] | ||
| ^^^^^^ | ||
|
||
error: link modifiers must be of the form `modifiers = "string"` | ||
--> $DIR/link-attr-validation-late.rs:24:22 | ||
| | ||
LL | #[link(name = "...", modifiers)] | ||
| ^^^^^^^^^ | ||
|
||
error: link modifiers must be of the form `modifiers = "string"` | ||
--> $DIR/link-attr-validation-late.rs:25:22 | ||
| | ||
LL | #[link(name = "...", modifiers())] | ||
| ^^^^^^^^^^^ | ||
|
||
error: link cfg must be of the form `cfg(/* predicate */)` | ||
--> $DIR/link-attr-validation-late.rs:26:22 | ||
| | ||
LL | #[link(name = "...", cfg)] | ||
| ^^^ | ||
|
||
error: link cfg must be of the form `cfg(/* predicate */)` | ||
--> $DIR/link-attr-validation-late.rs:27:22 | ||
| | ||
LL | #[link(name = "...", cfg = "literal")] | ||
| ^^^^^^^^^^^^^^^ | ||
|
||
error: link cfg must have a single predicate argument | ||
--> $DIR/link-attr-validation-late.rs:28:22 | ||
| | ||
LL | #[link(name = "...", cfg("literal"))] | ||
| ^^^^^^^^^^^^^^ | ||
|
||
error: wasm import module must be of the form `wasm_import_module = "string"` | ||
--> $DIR/link-attr-validation-late.rs:29:22 | ||
| | ||
LL | #[link(name = "...", wasm_import_module)] | ||
| ^^^^^^^^^^^^^^^^^^ | ||
|
||
error: wasm import module must be of the form `wasm_import_module = "string"` | ||
--> $DIR/link-attr-validation-late.rs:30:22 | ||
| | ||
LL | #[link(name = "...", wasm_import_module())] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed | ||
--> $DIR/link-attr-validation-late.rs:34:34 | ||
| | ||
LL | #[link(name = "...", modifiers = "")] | ||
| ^^ | ||
|
||
error: invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed | ||
--> $DIR/link-attr-validation-late.rs:35:34 | ||
| | ||
LL | #[link(name = "...", modifiers = "no-plus-minus")] | ||
| ^^^^^^^^^^^^^^^ | ||
|
||
error: unknown linking modifier `unknown`, expected one of: bundle, verbatim, whole-archive, as-needed | ||
--> $DIR/link-attr-validation-late.rs:36:34 | ||
| | ||
LL | #[link(name = "...", modifiers = "+unknown")] | ||
| ^^^^^^^^^^ | ||
|
||
error: multiple `verbatim` modifiers in a single `modifiers` argument | ||
--> $DIR/link-attr-validation-late.rs:37:34 | ||
| | ||
LL | #[link(name = "...", modifiers = "+verbatim,+verbatim")] | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 24 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0459`. |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// compile-flags:-l static= | ||
// error-pattern: empty library name given via `-l` | ||
// error-pattern: library name must not be empty | ||
|
||
fn main() { | ||
} |
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 |
---|---|---|
@@ -1,4 +1,2 @@ | ||
error: empty library name given via `-l` | ||
|
||
error: aborting due to previous error | ||
error: library name must not be empty | ||
|
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// compile-flags:-l bar=foo | ||
// error-pattern: unknown library kind `bar`, expected one of dylib, framework, or static | ||
// error-pattern: unknown library kind `bar`, expected one of: static, dylib, framework | ||
|
||
fn main() { | ||
} |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
error: unknown library kind `bar`, expected one of dylib, framework, or static | ||
error: unknown library kind `bar`, expected one of: static, dylib, framework | ||
|
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// ignore-macos | ||
// ignore-ios | ||
// compile-flags:-l framework=foo | ||
// error-pattern: native frameworks are only available on macOS targets | ||
// error-pattern: library kind `framework` is only supported on Apple targets | ||
|
||
fn main() { | ||
} |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
error: native frameworks are only available on macOS targets | ||
error: library kind `framework` is only supported on Apple targets | ||
|
||
error: aborting due to previous error | ||
|
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// compile-flags:-l raw-dylib=foo | ||
// error-pattern: unknown library kind `raw-dylib`, expected one of dylib, framework, or static | ||
// error-pattern: unknown library kind `raw-dylib`, expected one of: static, dylib, framework | ||
|
||
fn main() { | ||
} |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
error: unknown library kind `raw-dylib`, expected one of dylib, framework, or static | ||
error: unknown library kind `raw-dylib`, expected one of: static, dylib, framework | ||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// Unspecified kind should fail with an error | ||
|
||
// compile-flags: -l =mylib | ||
// error-pattern: unknown library kind ``, expected one of dylib, framework, or static | ||
// error-pattern: unknown library kind ``, expected one of: static, dylib, framework | ||
|
||
fn main() {} |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
error: unknown library kind ``, expected one of dylib, framework, or static | ||
error: unknown library kind ``, expected one of: static, dylib, framework | ||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// Unspecified kind should fail with an error | ||
|
||
// compile-flags: -l :+bundle=mylib | ||
// error-pattern: unknown library kind ``, expected one of dylib, framework, or static | ||
// error-pattern: unknown library kind ``, expected one of: static, dylib, framework | ||
|
||
fn main() {} |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
error: unknown library kind ``, expected one of dylib, framework, or static | ||
error: unknown library kind ``, expected one of: static, dylib, framework | ||
|
2 changes: 1 addition & 1 deletion
2
src/test/ui/native-library-link-flags/modifiers-override-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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
error: duplicating linking modifier is currently unstable and only accepted on the nightly compiler | ||
error: multiple `whole-archive` modifiers in a single `-l` option | ||
|
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
26 changes: 10 additions & 16 deletions
26
src/test/ui/native-library-link-flags/modifiers-override.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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// compile-flags: -l dylib=foo:bar | ||
// error-pattern: overriding linking modifiers from command line is not supported | ||
|
||
#![feature(native_link_modifiers_as_needed)] | ||
|
||
#![crate_type = "lib"] | ||
|
||
#[link(name = "foo", kind = "dylib", modifiers = "-as-needed")] | ||
extern "C" {} |
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,8 @@ | ||
error: overriding linking modifiers from command line is not supported | ||
--> $DIR/rename-modifiers.rs:9:1 | ||
| | ||
LL | extern "C" {} | ||
| ^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
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
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 |
---|---|---|
@@ -1,20 +1,38 @@ | ||
error: must be of the form `#[link(wasm_import_module = "...")]` | ||
--> $DIR/wasm-import-module.rs:1:22 | ||
error: wasm import module must be of the form `wasm_import_module = "string"` | ||
--> $DIR/wasm-import-module.rs:3:22 | ||
| | ||
LL | #[link(name = "...", wasm_import_module)] | ||
| ^^^^^^^^^^^^^^^^^^ | ||
|
||
error: must be of the form `#[link(wasm_import_module = "...")]` | ||
--> $DIR/wasm-import-module.rs:4:22 | ||
error: wasm import module must be of the form `wasm_import_module = "string"` | ||
--> $DIR/wasm-import-module.rs:6:22 | ||
| | ||
LL | #[link(name = "...", wasm_import_module(x))] | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: must be of the form `#[link(wasm_import_module = "...")]` | ||
--> $DIR/wasm-import-module.rs:7:22 | ||
error: wasm import module must be of the form `wasm_import_module = "string"` | ||
--> $DIR/wasm-import-module.rs:9:22 | ||
| | ||
LL | #[link(name = "...", wasm_import_module())] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 3 previous errors | ||
error: `wasm_import_module` is incompatible with other arguments in `#[link]` attributes | ||
--> $DIR/wasm-import-module.rs:12:8 | ||
| | ||
LL | #[link(wasm_import_module = "foo", name = "bar")] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: `wasm_import_module` is incompatible with other arguments in `#[link]` attributes | ||
--> $DIR/wasm-import-module.rs:15:8 | ||
| | ||
LL | #[link(wasm_import_module = "foo", kind = "dylib")] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: `wasm_import_module` is incompatible with other arguments in `#[link]` attributes | ||
--> $DIR/wasm-import-module.rs:18:8 | ||
| | ||
LL | #[link(wasm_import_module = "foo", cfg(FALSE))] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 6 previous errors | ||
|