]> git.lizzy.rs Git - rust.git/blob - tests/ui/linkage-attr/link-attr-validation-late.rs
Rollup merge of #106766 - GuillaumeGomez:rm-stripper-dead-code, r=notriddle
[rust.git] / tests / ui / linkage-attr / link-attr-validation-late.rs
1 #![feature(link_cfg)]
2
3 // Top-level ill-formed
4 #[link(name = "...", "literal")] //~ ERROR unexpected `#[link]` argument
5 #[link(name = "...", unknown)] //~ ERROR unexpected `#[link]` argument
6 extern "C" {}
7
8 // Duplicate arguments
9 #[link(name = "foo", name = "bar")] //~ ERROR multiple `name` arguments
10 #[link(name = "...", kind = "dylib", kind = "bar")] //~ ERROR multiple `kind` arguments
11 #[link(name = "...", modifiers = "+verbatim", modifiers = "bar")] //~ ERROR multiple `modifiers` arguments
12 #[link(name = "...", cfg(FALSE), cfg(FALSE))] //~ ERROR multiple `cfg` arguments
13 #[link(wasm_import_module = "foo", wasm_import_module = "bar")] //~ ERROR multiple `wasm_import_module` arguments
14 extern "C" {}
15
16 // Ill-formed arguments
17 #[link(name)] //~ ERROR link name must be of the form `name = "string"`
18               //~| ERROR `#[link]` attribute requires a `name = "string"` argument
19 #[link(name())] //~ ERROR link name must be of the form `name = "string"`
20               //~| ERROR `#[link]` attribute requires a `name = "string"` argument
21 #[link(name = "...", kind)] //~ ERROR link kind must be of the form `kind = "string"`
22 #[link(name = "...", kind())] //~ ERROR link kind must be of the form `kind = "string"`
23 #[link(name = "...", modifiers)] //~ ERROR link modifiers must be of the form `modifiers = "string"`
24 #[link(name = "...", modifiers())] //~ ERROR link modifiers must be of the form `modifiers = "string"`
25 #[link(name = "...", cfg)] //~ ERROR link cfg must be of the form `cfg(/* predicate */)`
26 #[link(name = "...", cfg = "literal")] //~ ERROR link cfg must be of the form `cfg(/* predicate */)`
27 #[link(name = "...", cfg("literal"))] //~ ERROR link cfg must have a single predicate argument
28 #[link(name = "...", wasm_import_module)] //~ ERROR wasm import module must be of the form `wasm_import_module = "string"`
29 #[link(name = "...", wasm_import_module())] //~ ERROR wasm import module must be of the form `wasm_import_module = "string"`
30 extern "C" {}
31
32 // Basic modifier validation
33 #[link(name = "...", modifiers = "")] //~ ERROR invalid linking modifier syntax, expected '+' or '-' prefix
34 #[link(name = "...", modifiers = "no-plus-minus")] //~ ERROR invalid linking modifier syntax, expected '+' or '-' prefix
35 #[link(name = "...", modifiers = "+unknown")] //~ ERROR unknown linking modifier `unknown`
36 #[link(name = "...", modifiers = "+verbatim,+verbatim")] //~ ERROR multiple `verbatim` modifiers
37 extern "C" {}
38
39 fn main() {}