diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2022-03-14 13:28:34 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2022-05-15 02:45:47 +0300 |
| commit | 4fa24bcb54cd11ec9c5e95d6d0ef366e512d27d6 (patch) | |
| tree | b4cdd23b4393d38383b89a25650f34dabf1ec378 /src/test/ui/wasm | |
| parent | 70b3681bf621bc0de91ffab711b2350068b4c466 (diff) | |
rustc: Stricter checking for #[link] attributes
Diffstat (limited to 'src/test/ui/wasm')
| -rw-r--r-- | src/test/ui/wasm/wasm-import-module.rs | 11 | ||||
| -rw-r--r-- | src/test/ui/wasm/wasm-import-module.stderr | 32 |
2 files changed, 36 insertions, 7 deletions
diff --git a/src/test/ui/wasm/wasm-import-module.rs b/src/test/ui/wasm/wasm-import-module.rs index 4152a1065ca..bff08847d37 100644 --- a/src/test/ui/wasm/wasm-import-module.rs +++ b/src/test/ui/wasm/wasm-import-module.rs @@ -1,3 +1,5 @@ +#![feature(link_cfg)] + #[link(name = "...", wasm_import_module)] //~ ERROR: must be of the form extern "C" {} @@ -7,4 +9,13 @@ extern "C" {} #[link(name = "...", wasm_import_module())] //~ ERROR: must be of the form extern "C" {} +#[link(wasm_import_module = "foo", name = "bar")] //~ ERROR: `wasm_import_module` is incompatible with other arguments +extern "C" {} + +#[link(wasm_import_module = "foo", kind = "dylib")] //~ ERROR: `wasm_import_module` is incompatible with other arguments +extern "C" {} + +#[link(wasm_import_module = "foo", cfg(FALSE))] //~ ERROR: `wasm_import_module` is incompatible with other arguments +extern "C" {} + fn main() {} diff --git a/src/test/ui/wasm/wasm-import-module.stderr b/src/test/ui/wasm/wasm-import-module.stderr index 47d6cb68997..e792c33e91a 100644 --- a/src/test/ui/wasm/wasm-import-module.stderr +++ b/src/test/ui/wasm/wasm-import-module.stderr @@ -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 |
