diff options
| author | Jonathan Brouwer <jonathantbrouwer@gmail.com> | 2025-07-16 13:46:25 +0200 |
|---|---|---|
| committer | Jonathan Brouwer <jonathantbrouwer@gmail.com> | 2025-08-27 20:25:18 +0200 |
| commit | 7db184056909045802a66299947dc81c8e43e605 (patch) | |
| tree | 5ed0cf50821ace2fc56915361c56487b127ec35d | |
| parent | e8d08b5416c0fd159388fe6cdd1a3b43dd759132 (diff) | |
| download | rust-7db184056909045802a66299947dc81c8e43e605.tar.gz rust-7db184056909045802a66299947dc81c8e43e605.zip | |
Changes to the uitests
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
37 files changed, 945 insertions, 366 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0458.md b/compiler/rustc_error_codes/src/error_codes/E0458.md index 1b280cba44f..651bc378879 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0458.md +++ b/compiler/rustc_error_codes/src/error_codes/E0458.md @@ -1,8 +1,10 @@ +#### Note: this error code is no longer emitted by the compiler. + An unknown "kind" was specified for a link attribute. Erroneous code example: -```compile_fail,E0458 +```ignore (no longer emitted) #[link(kind = "wonderful_unicorn")] extern "C" {} // error: unknown kind: `wonderful_unicorn` ``` diff --git a/tests/crashes/120175.rs b/tests/crashes/120175.rs index c6e7203ff98..e441454bed2 100644 --- a/tests/crashes/120175.rs +++ b/tests/crashes/120175.rs @@ -2,8 +2,9 @@ //@ needs-rustc-debug-assertions #![feature(extern_types)] +#![feature(raw_dylib_elf)] -#[link(name = "bar", import_name_type = "decorated", kind = "raw-dylib")] +#[link(name = "bar", kind = "raw-dylib")] extern "C" { pub type CrossCrate; } diff --git a/tests/ui/attributes/malformed-attrs.rs b/tests/ui/attributes/malformed-attrs.rs index 90ca007451e..932aaf7a9e2 100644 --- a/tests/ui/attributes/malformed-attrs.rs +++ b/tests/ui/attributes/malformed-attrs.rs @@ -81,8 +81,7 @@ #[export_stable = 1] //~^ ERROR malformed #[link] -//~^ ERROR valid forms for the attribute are -//~| WARN this was previously accepted by the compiler +//~^ ERROR malformed #[link_name] //~^ ERROR malformed #[link_section] diff --git a/tests/ui/attributes/malformed-attrs.stderr b/tests/ui/attributes/malformed-attrs.stderr index 69f9a18c179..b85864b401e 100644 --- a/tests/ui/attributes/malformed-attrs.stderr +++ b/tests/ui/attributes/malformed-attrs.stderr @@ -1,5 +1,5 @@ error[E0539]: malformed `cfg` attribute input - --> $DIR/malformed-attrs.rs:102:1 + --> $DIR/malformed-attrs.rs:101:1 | LL | #[cfg] | ^^^^^^ @@ -10,7 +10,7 @@ LL | #[cfg] = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute> error: malformed `cfg_attr` attribute input - --> $DIR/malformed-attrs.rs:104:1 + --> $DIR/malformed-attrs.rs:103:1 | LL | #[cfg_attr] | ^^^^^^^^^^^ @@ -22,7 +22,7 @@ LL | #[cfg_attr(condition, attribute, other_attribute, ...)] | ++++++++++++++++++++++++++++++++++++++++++++ error[E0463]: can't find crate for `wloop` - --> $DIR/malformed-attrs.rs:211:1 + --> $DIR/malformed-attrs.rs:210:1 | LL | extern crate wloop; | ^^^^^^^^^^^^^^^^^^^ can't find crate @@ -42,7 +42,7 @@ LL | #![windows_subsystem = "windows"] | +++++++++++ error: malformed `instruction_set` attribute input - --> $DIR/malformed-attrs.rs:106:1 + --> $DIR/malformed-attrs.rs:105:1 | LL | #[instruction_set] | ^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[instruction_set(set)]` @@ -50,13 +50,13 @@ LL | #[instruction_set] = note: for more information, visit <https://doc.rust-lang.org/reference/attributes/codegen.html#the-instruction_set-attribute> error: malformed `patchable_function_entry` attribute input - --> $DIR/malformed-attrs.rs:108:1 + --> $DIR/malformed-attrs.rs:107:1 | LL | #[patchable_function_entry] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[patchable_function_entry(prefix_nops = m, entry_nops = n)]` error: malformed `must_not_suspend` attribute input - --> $DIR/malformed-attrs.rs:132:1 + --> $DIR/malformed-attrs.rs:131:1 | LL | #[must_not_suspend()] | ^^^^^^^^^^^^^^^^^^^^^ @@ -71,13 +71,13 @@ LL + #[must_not_suspend] | error: malformed `cfi_encoding` attribute input - --> $DIR/malformed-attrs.rs:134:1 + --> $DIR/malformed-attrs.rs:133:1 | LL | #[cfi_encoding] | ^^^^^^^^^^^^^^^ help: must be of the form: `#[cfi_encoding = "encoding"]` error: malformed `allow` attribute input - --> $DIR/malformed-attrs.rs:178:1 + --> $DIR/malformed-attrs.rs:177:1 | LL | #[allow] | ^^^^^^^^ @@ -93,7 +93,7 @@ LL | #[allow(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `expect` attribute input - --> $DIR/malformed-attrs.rs:180:1 + --> $DIR/malformed-attrs.rs:179:1 | LL | #[expect] | ^^^^^^^^^ @@ -109,7 +109,7 @@ LL | #[expect(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `warn` attribute input - --> $DIR/malformed-attrs.rs:182:1 + --> $DIR/malformed-attrs.rs:181:1 | LL | #[warn] | ^^^^^^^ @@ -125,7 +125,7 @@ LL | #[warn(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `deny` attribute input - --> $DIR/malformed-attrs.rs:184:1 + --> $DIR/malformed-attrs.rs:183:1 | LL | #[deny] | ^^^^^^^ @@ -141,7 +141,7 @@ LL | #[deny(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `forbid` attribute input - --> $DIR/malformed-attrs.rs:186:1 + --> $DIR/malformed-attrs.rs:185:1 | LL | #[forbid] | ^^^^^^^^^ @@ -157,7 +157,7 @@ LL | #[forbid(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `debugger_visualizer` attribute input - --> $DIR/malformed-attrs.rs:188:1 + --> $DIR/malformed-attrs.rs:187:1 | LL | #[debugger_visualizer] | ^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[debugger_visualizer(natvis_file = "...", gdb_script_file = "...")]` @@ -165,13 +165,13 @@ LL | #[debugger_visualizer] = note: for more information, visit <https://doc.rust-lang.org/reference/attributes/debugger.html#the-debugger_visualizer-attribute> error: malformed `thread_local` attribute input - --> $DIR/malformed-attrs.rs:203:1 + --> $DIR/malformed-attrs.rs:202:1 | LL | #[thread_local()] | ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[thread_local]` error: malformed `no_link` attribute input - --> $DIR/malformed-attrs.rs:207:1 + --> $DIR/malformed-attrs.rs:206:1 | LL | #[no_link()] | ^^^^^^^^^^^^ help: must be of the form: `#[no_link]` @@ -179,7 +179,7 @@ LL | #[no_link()] = note: for more information, visit <https://doc.rust-lang.org/reference/items/extern-crates.html#the-no_link-attribute> error: malformed `macro_export` attribute input - --> $DIR/malformed-attrs.rs:214:1 + --> $DIR/malformed-attrs.rs:213:1 | LL | #[macro_export = 18] | ^^^^^^^^^^^^^^^^^^^^ @@ -195,25 +195,25 @@ LL + #[macro_export] | error: the `#[proc_macro]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/malformed-attrs.rs:99:1 + --> $DIR/malformed-attrs.rs:98:1 | LL | #[proc_macro = 18] | ^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_attribute]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/malformed-attrs.rs:116:1 + --> $DIR/malformed-attrs.rs:115:1 | LL | #[proc_macro_attribute = 19] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/malformed-attrs.rs:123:1 + --> $DIR/malformed-attrs.rs:122:1 | LL | #[proc_macro_derive] | ^^^^^^^^^^^^^^^^^^^^ error[E0658]: allow_internal_unsafe side-steps the unsafe_code lint - --> $DIR/malformed-attrs.rs:216:1 + --> $DIR/malformed-attrs.rs:215:1 | LL | #[allow_internal_unsafe = 1] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -242,18 +242,8 @@ LL | #[doc] = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571> = note: for more information, visit <https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html> -error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]` - --> $DIR/malformed-attrs.rs:83:1 - | -LL | #[link] - | ^^^^^^^ - | - = 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> - = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> - error: invalid argument - --> $DIR/malformed-attrs.rs:188:1 + --> $DIR/malformed-attrs.rs:187:1 | LL | #[debugger_visualizer] | ^^^^^^^^^^^^^^^^^^^^^^ @@ -494,8 +484,27 @@ LL | #[export_stable = 1] | | didn't expect any arguments here | help: must be of the form: `#[export_stable]` +error[E0539]: malformed `link` attribute input + --> $DIR/malformed-attrs.rs:83:1 + | +LL | #[link] + | ^^^^^^^ expected this to be a list + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL | #[link(name = "...")] + | ++++++++++++++ +LL | #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +LL | #[link(name = "...", kind = "dylib|static|...")] + | +++++++++++++++++++++++++++++++++++++++++ +LL | #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + = and 1 other candidate + error[E0539]: malformed `link_name` attribute input - --> $DIR/malformed-attrs.rs:86:1 + --> $DIR/malformed-attrs.rs:85:1 | LL | #[link_name] | ^^^^^^^^^^^^ help: must be of the form: `#[link_name = "name"]` @@ -503,7 +512,7 @@ LL | #[link_name] = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_name-attribute> error[E0539]: malformed `link_section` attribute input - --> $DIR/malformed-attrs.rs:88:1 + --> $DIR/malformed-attrs.rs:87:1 | LL | #[link_section] | ^^^^^^^^^^^^^^^ help: must be of the form: `#[link_section = "name"]` @@ -511,7 +520,7 @@ LL | #[link_section] = note: for more information, visit <https://doc.rust-lang.org/reference/abi.html#the-link_section-attribute> error[E0539]: malformed `coverage` attribute input - --> $DIR/malformed-attrs.rs:90:1 + --> $DIR/malformed-attrs.rs:89:1 | LL | #[coverage] | ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument @@ -524,7 +533,7 @@ LL | #[coverage(on)] | ++++ error[E0539]: malformed `sanitize` attribute input - --> $DIR/malformed-attrs.rs:92:1 + --> $DIR/malformed-attrs.rs:91:1 | LL | #[sanitize] | ^^^^^^^^^^^ expected this to be a list @@ -542,7 +551,7 @@ LL | #[sanitize(kcfi = "on|off")] = and 5 other candidates error[E0565]: malformed `no_implicit_prelude` attribute input - --> $DIR/malformed-attrs.rs:97:1 + --> $DIR/malformed-attrs.rs:96:1 | LL | #[no_implicit_prelude = 23] | ^^^^^^^^^^^^^^^^^^^^^^----^ @@ -551,7 +560,7 @@ LL | #[no_implicit_prelude = 23] | help: must be of the form: `#[no_implicit_prelude]` error[E0565]: malformed `proc_macro` attribute input - --> $DIR/malformed-attrs.rs:99:1 + --> $DIR/malformed-attrs.rs:98:1 | LL | #[proc_macro = 18] | ^^^^^^^^^^^^^----^ @@ -560,7 +569,7 @@ LL | #[proc_macro = 18] | help: must be of the form: `#[proc_macro]` error[E0565]: malformed `coroutine` attribute input - --> $DIR/malformed-attrs.rs:111:5 + --> $DIR/malformed-attrs.rs:110:5 | LL | #[coroutine = 63] || {} | ^^^^^^^^^^^^----^ @@ -569,7 +578,7 @@ LL | #[coroutine = 63] || {} | help: must be of the form: `#[coroutine]` error[E0565]: malformed `proc_macro_attribute` attribute input - --> $DIR/malformed-attrs.rs:116:1 + --> $DIR/malformed-attrs.rs:115:1 | LL | #[proc_macro_attribute = 19] | ^^^^^^^^^^^^^^^^^^^^^^^----^ @@ -578,7 +587,7 @@ LL | #[proc_macro_attribute = 19] | help: must be of the form: `#[proc_macro_attribute]` error[E0539]: malformed `must_use` attribute input - --> $DIR/malformed-attrs.rs:119:1 + --> $DIR/malformed-attrs.rs:118:1 | LL | #[must_use = 1] | ^^^^^^^^^^^^^-^ @@ -596,7 +605,7 @@ LL + #[must_use] | error[E0539]: malformed `proc_macro_derive` attribute input - --> $DIR/malformed-attrs.rs:123:1 + --> $DIR/malformed-attrs.rs:122:1 | LL | #[proc_macro_derive] | ^^^^^^^^^^^^^^^^^^^^ expected this to be a list @@ -610,7 +619,7 @@ LL | #[proc_macro_derive(TraitName, attributes(name1, name2, ...))] | ++++++++++++++++++++++++++++++++++++++++++ error[E0539]: malformed `rustc_layout_scalar_valid_range_start` attribute input - --> $DIR/malformed-attrs.rs:128:1 + --> $DIR/malformed-attrs.rs:127:1 | LL | #[rustc_layout_scalar_valid_range_start] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -619,7 +628,7 @@ LL | #[rustc_layout_scalar_valid_range_start] | help: must be of the form: `#[rustc_layout_scalar_valid_range_start(start)]` error[E0539]: malformed `rustc_layout_scalar_valid_range_end` attribute input - --> $DIR/malformed-attrs.rs:130:1 + --> $DIR/malformed-attrs.rs:129:1 | LL | #[rustc_layout_scalar_valid_range_end] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -628,7 +637,7 @@ LL | #[rustc_layout_scalar_valid_range_end] | help: must be of the form: `#[rustc_layout_scalar_valid_range_end(end)]` error[E0565]: malformed `marker` attribute input - --> $DIR/malformed-attrs.rs:155:1 + --> $DIR/malformed-attrs.rs:154:1 | LL | #[marker = 3] | ^^^^^^^^^---^ @@ -637,7 +646,7 @@ LL | #[marker = 3] | help: must be of the form: `#[marker]` error[E0565]: malformed `fundamental` attribute input - --> $DIR/malformed-attrs.rs:157:1 + --> $DIR/malformed-attrs.rs:156:1 | LL | #[fundamental()] | ^^^^^^^^^^^^^--^ @@ -646,7 +655,7 @@ LL | #[fundamental()] | help: must be of the form: `#[fundamental]` error[E0565]: malformed `ffi_pure` attribute input - --> $DIR/malformed-attrs.rs:165:5 + --> $DIR/malformed-attrs.rs:164:5 | LL | #[unsafe(ffi_pure = 1)] | ^^^^^^^^^^^^^^^^^^---^^ @@ -655,7 +664,7 @@ LL | #[unsafe(ffi_pure = 1)] | help: must be of the form: `#[ffi_pure]` error[E0539]: malformed `link_ordinal` attribute input - --> $DIR/malformed-attrs.rs:167:5 + --> $DIR/malformed-attrs.rs:166:5 | LL | #[link_ordinal] | ^^^^^^^^^^^^^^^ @@ -666,7 +675,7 @@ LL | #[link_ordinal] = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_ordinal-attribute> error[E0565]: malformed `ffi_const` attribute input - --> $DIR/malformed-attrs.rs:171:5 + --> $DIR/malformed-attrs.rs:170:5 | LL | #[unsafe(ffi_const = 1)] | ^^^^^^^^^^^^^^^^^^^---^^ @@ -675,7 +684,7 @@ LL | #[unsafe(ffi_const = 1)] | help: must be of the form: `#[ffi_const]` error[E0539]: malformed `linkage` attribute input - --> $DIR/malformed-attrs.rs:173:5 + --> $DIR/malformed-attrs.rs:172:5 | LL | #[linkage] | ^^^^^^^^^^ expected this to be of the form `linkage = "..."` @@ -693,7 +702,7 @@ LL | #[linkage = "external"] = and 5 other candidates error[E0565]: malformed `automatically_derived` attribute input - --> $DIR/malformed-attrs.rs:191:1 + --> $DIR/malformed-attrs.rs:190:1 | LL | #[automatically_derived = 18] | ^^^^^^^^^^^^^^^^^^^^^^^^----^ @@ -702,7 +711,7 @@ LL | #[automatically_derived = 18] | help: must be of the form: `#[automatically_derived]` error[E0565]: malformed `non_exhaustive` attribute input - --> $DIR/malformed-attrs.rs:197:1 + --> $DIR/malformed-attrs.rs:196:1 | LL | #[non_exhaustive = 1] | ^^^^^^^^^^^^^^^^^---^ @@ -711,13 +720,13 @@ LL | #[non_exhaustive = 1] | help: must be of the form: `#[non_exhaustive]` error: valid forms for the attribute are `#[macro_use(name1, name2, ...)]` and `#[macro_use]` - --> $DIR/malformed-attrs.rs:209:1 + --> $DIR/malformed-attrs.rs:208:1 | LL | #[macro_use = 1] | ^^^^^^^^^^^^^^^^ error[E0565]: malformed `allow_internal_unsafe` attribute input - --> $DIR/malformed-attrs.rs:216:1 + --> $DIR/malformed-attrs.rs:215:1 | LL | #[allow_internal_unsafe = 1] | ^^^^^^^^^^^^^^^^^^^^^^^^---^ @@ -726,7 +735,7 @@ LL | #[allow_internal_unsafe = 1] | help: must be of the form: `#[allow_internal_unsafe]` error[E0565]: malformed `type_const` attribute input - --> $DIR/malformed-attrs.rs:143:5 + --> $DIR/malformed-attrs.rs:142:5 | LL | #[type_const = 1] | ^^^^^^^^^^^^^---^ @@ -759,7 +768,7 @@ LL | #[repr] | ^^^^^^^ warning: `#[diagnostic::do_not_recommend]` does not expect any arguments - --> $DIR/malformed-attrs.rs:149:1 + --> $DIR/malformed-attrs.rs:148:1 | LL | #[diagnostic::do_not_recommend()] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -767,7 +776,7 @@ LL | #[diagnostic::do_not_recommend()] = note: `#[warn(malformed_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default warning: missing options for `on_unimplemented` attribute - --> $DIR/malformed-attrs.rs:138:1 + --> $DIR/malformed-attrs.rs:137:1 | LL | #[diagnostic::on_unimplemented] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -775,7 +784,7 @@ LL | #[diagnostic::on_unimplemented] = help: at least one of the `message`, `note` and `label` options are expected warning: malformed `on_unimplemented` attribute - --> $DIR/malformed-attrs.rs:140:1 + --> $DIR/malformed-attrs.rs:139:1 | LL | #[diagnostic::on_unimplemented = 1] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here @@ -792,7 +801,7 @@ LL | #[inline = 5] = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571> error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` - --> $DIR/malformed-attrs.rs:94:1 + --> $DIR/malformed-attrs.rs:93:1 | LL | #[ignore()] | ^^^^^^^^^^^ @@ -801,7 +810,7 @@ LL | #[ignore()] = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571> error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` - --> $DIR/malformed-attrs.rs:223:1 + --> $DIR/malformed-attrs.rs:222:1 | LL | #[ignore = 1] | ^^^^^^^^^^^^^ @@ -810,7 +819,7 @@ LL | #[ignore = 1] = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571> error[E0308]: mismatched types - --> $DIR/malformed-attrs.rs:111:23 + --> $DIR/malformed-attrs.rs:110:23 | LL | fn test() { | - help: a return type might be missing here: `-> _` @@ -818,7 +827,7 @@ LL | #[coroutine = 63] || {} | ^^^^^ expected `()`, found coroutine | = note: expected unit type `()` - found coroutine `{coroutine@$DIR/malformed-attrs.rs:111:23: 111:25}` + found coroutine `{coroutine@$DIR/malformed-attrs.rs:110:23: 110:25}` error: aborting due to 77 previous errors; 3 warnings emitted @@ -849,18 +858,6 @@ LL | #[doc] = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: -error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]` - --> $DIR/malformed-attrs.rs:83:1 - | -LL | #[link] - | ^^^^^^^ - | - = 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> - = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> - = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default - -Future breakage diagnostic: error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]` --> $DIR/malformed-attrs.rs:52:1 | @@ -873,7 +870,7 @@ LL | #[inline = 5] Future breakage diagnostic: error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` - --> $DIR/malformed-attrs.rs:94:1 + --> $DIR/malformed-attrs.rs:93:1 | LL | #[ignore()] | ^^^^^^^^^^^ @@ -884,7 +881,7 @@ LL | #[ignore()] Future breakage diagnostic: error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` - --> $DIR/malformed-attrs.rs:223:1 + --> $DIR/malformed-attrs.rs:222:1 | LL | #[ignore = 1] | ^^^^^^^^^^^^^ diff --git a/tests/ui/error-codes/E0458.rs b/tests/ui/error-codes/E0458.rs index 35e7e84d479..0e35ba43bfb 100644 --- a/tests/ui/error-codes/E0458.rs +++ b/tests/ui/error-codes/E0458.rs @@ -1,4 +1,4 @@ -#[link(kind = "wonderful_unicorn")] extern "C" {} //~ ERROR E0458 +#[link(kind = "wonderful_unicorn")] extern "C" {} //~ ERROR malformed `link` attribute input [E0539] //~| ERROR E0459 fn main() { diff --git a/tests/ui/error-codes/E0458.stderr b/tests/ui/error-codes/E0458.stderr index c13ae4e7862..524765ea12a 100644 --- a/tests/ui/error-codes/E0458.stderr +++ b/tests/ui/error-codes/E0458.stderr @@ -1,8 +1,27 @@ -error[E0458]: unknown link kind `wonderful_unicorn`, expected one of: static, dylib, framework, raw-dylib, link-arg - --> $DIR/E0458.rs:1:15 +error[E0539]: malformed `link` attribute input + --> $DIR/E0458.rs:1:1 | LL | #[link(kind = "wonderful_unicorn")] extern "C" {} - | ^^^^^^^^^^^^^^^^^^^ unknown link kind + | ^^^^^^^^^^^^^^-------------------^^ + | | + | valid arguments are "static", "dylib", "framework", "raw-dylib" or "link-arg" + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(kind = "wonderful_unicorn")] extern "C" {} +LL + #[link(name = "...")] extern "C" {} + | +LL - #[link(kind = "wonderful_unicorn")] extern "C" {} +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] extern "C" {} + | +LL - #[link(kind = "wonderful_unicorn")] extern "C" {} +LL + #[link(name = "...", kind = "dylib|static|...")] extern "C" {} + | +LL - #[link(kind = "wonderful_unicorn")] extern "C" {} +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] extern "C" {} + | + = and 1 other candidate error[E0459]: `#[link]` attribute requires a `name = "string"` argument --> $DIR/E0458.rs:1:1 @@ -12,5 +31,5 @@ LL | #[link(kind = "wonderful_unicorn")] extern "C" {} error: aborting due to 2 previous errors -Some errors have detailed explanations: E0458, E0459. -For more information about an error, try `rustc --explain E0458`. +Some errors have detailed explanations: E0459, E0539. +For more information about an error, try `rustc --explain E0459`. diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs index 3d814700d98..e5dae4c0069 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs +++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs @@ -69,7 +69,7 @@ //~| WARN previously accepted //~| HELP can only be applied to //~| HELP remove the attribute -#![link()] //~ WARN attribute should be applied to an `extern` block +#![link(name = "x")] //~ WARN attribute should be applied to an `extern` block //~^ WARN this was previously accepted #![link_name = "1900"] //~^ WARN attribute cannot be used on @@ -692,38 +692,38 @@ mod link_section { // Note that this is a `check-pass` test, so it will never invoke the linker. -#[link()] +#[link(name = "x")] //~^ WARN attribute should be applied to an `extern` block //~| WARN this was previously accepted mod link { //~^ NOTE not an `extern` block - mod inner { #![link()] } + mod inner { #![link(name = "x")] } //~^ WARN attribute should be applied to an `extern` block //~| WARN this was previously accepted //~| NOTE not an `extern` block - #[link()] fn f() { } + #[link(name = "x")] fn f() { } //~^ WARN attribute should be applied to an `extern` block //~| WARN this was previously accepted //~| NOTE not an `extern` block - #[link()] struct S; + #[link(name = "x")] struct S; //~^ WARN attribute should be applied to an `extern` block //~| WARN this was previously accepted //~| NOTE not an `extern` block - #[link()] type T = S; + #[link(name = "x")] type T = S; //~^ WARN attribute should be applied to an `extern` block //~| WARN this was previously accepted //~| NOTE not an `extern` block - #[link()] impl S { } + #[link(name = "x")] impl S { } //~^ WARN attribute should be applied to an `extern` block //~| WARN this was previously accepted //~| NOTE not an `extern` block - #[link()] extern "Rust" {} + #[link(name = "x")] extern "Rust" {} //~^ WARN attribute should be applied to an `extern` block //~| WARN this was previously accepted } diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr index 65e3d29e269..ef74a00e5a1 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr +++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr @@ -223,13 +223,13 @@ LL | #![no_std] warning: attribute should be applied to an `extern` block with non-Rust ABI --> $DIR/issue-43106-gating-of-builtin-attrs.rs:695:1 | -LL | #[link()] - | ^^^^^^^^^ +LL | #[link(name = "x")] + | ^^^^^^^^^^^^^^^^^^^ ... LL | / mod link { LL | | LL | | -LL | | mod inner { #![link()] } +LL | | mod inner { #![link(name = "x")] } ... | LL | | } | |_- not an `extern` block @@ -316,8 +316,8 @@ LL | #![type_length_limit="0100"] warning: attribute should be applied to an `extern` block with non-Rust ABI --> $DIR/issue-43106-gating-of-builtin-attrs.rs:72:1 | -LL | #![link()] - | ^^^^^^^^^^ not an `extern` block +LL | #![link(name = "x")] + | ^^^^^^^^^^^^^^^^^^^^ not an `extern` block | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -462,48 +462,48 @@ LL | #![no_std] impl S { } warning: attribute should be applied to an `extern` block with non-Rust ABI --> $DIR/issue-43106-gating-of-builtin-attrs.rs:701:17 | -LL | mod inner { #![link()] } - | ------------^^^^^^^^^^-- not an `extern` block +LL | mod inner { #![link(name = "x")] } + | ------------^^^^^^^^^^^^^^^^^^^^-- not an `extern` block | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to an `extern` block with non-Rust ABI --> $DIR/issue-43106-gating-of-builtin-attrs.rs:706:5 | -LL | #[link()] fn f() { } - | ^^^^^^^^^ ---------- not an `extern` block +LL | #[link(name = "x")] fn f() { } + | ^^^^^^^^^^^^^^^^^^^ ---------- not an `extern` block | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to an `extern` block with non-Rust ABI --> $DIR/issue-43106-gating-of-builtin-attrs.rs:711:5 | -LL | #[link()] struct S; - | ^^^^^^^^^ --------- not an `extern` block +LL | #[link(name = "x")] struct S; + | ^^^^^^^^^^^^^^^^^^^ --------- not an `extern` block | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to an `extern` block with non-Rust ABI --> $DIR/issue-43106-gating-of-builtin-attrs.rs:716:5 | -LL | #[link()] type T = S; - | ^^^^^^^^^ ----------- not an `extern` block +LL | #[link(name = "x")] type T = S; + | ^^^^^^^^^^^^^^^^^^^ ----------- not an `extern` block | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to an `extern` block with non-Rust ABI --> $DIR/issue-43106-gating-of-builtin-attrs.rs:721:5 | -LL | #[link()] impl S { } - | ^^^^^^^^^ ---------- not an `extern` block +LL | #[link(name = "x")] impl S { } + | ^^^^^^^^^^^^^^^^^^^ ---------- not an `extern` block | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to an `extern` block with non-Rust ABI --> $DIR/issue-43106-gating-of-builtin-attrs.rs:726:5 | -LL | #[link()] extern "Rust" {} - | ^^^^^^^^^ +LL | #[link(name = "x")] extern "Rust" {} + | ^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/tests/ui/link-native-libs/issue-43925.rs b/tests/ui/link-native-libs/issue-43925.rs index 1a210887154..e3ce71352c0 100644 --- a/tests/ui/link-native-libs/issue-43925.rs +++ b/tests/ui/link-native-libs/issue-43925.rs @@ -1,4 +1,6 @@ -#[link(name = "foo", cfg("rlib"))] //~ ERROR link cfg must have a single predicate argument +#[link(name = "foo", cfg("rlib"))] +//~^ ERROR link cfg is unstable +//~| ERROR `cfg` predicate key must be an identifier extern "C" {} fn main() {} diff --git a/tests/ui/link-native-libs/issue-43925.stderr b/tests/ui/link-native-libs/issue-43925.stderr index 7cc347c6163..82d204222df 100644 --- a/tests/ui/link-native-libs/issue-43925.stderr +++ b/tests/ui/link-native-libs/issue-43925.stderr @@ -1,8 +1,18 @@ -error: link cfg must have a single predicate argument +error[E0658]: link cfg is unstable --> $DIR/issue-43925.rs:1:22 | LL | #[link(name = "foo", cfg("rlib"))] | ^^^^^^^^^^^ + | + = help: add `#![feature(link_cfg)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: `cfg` predicate key must be an identifier + --> $DIR/issue-43925.rs:1:26 + | +LL | #[link(name = "foo", cfg("rlib"))] + | ^^^^^^ -error: aborting due to 1 previous error +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/link-native-libs/issue-43926.rs b/tests/ui/link-native-libs/issue-43926.rs index 6d3003552dc..293ad3f4ec1 100644 --- a/tests/ui/link-native-libs/issue-43926.rs +++ b/tests/ui/link-native-libs/issue-43926.rs @@ -1,4 +1,4 @@ -#[link(name = "foo", cfg())] //~ ERROR link cfg must have a single predicate argument +#[link(name = "foo", cfg())] //~ ERROR malformed `link` attribute input extern "C" {} fn main() {} diff --git a/tests/ui/link-native-libs/issue-43926.stderr b/tests/ui/link-native-libs/issue-43926.stderr index 7c5c50a38a9..9e3ec21cc94 100644 --- a/tests/ui/link-native-libs/issue-43926.stderr +++ b/tests/ui/link-native-libs/issue-43926.stderr @@ -1,8 +1,28 @@ -error: link cfg must have a single predicate argument - --> $DIR/issue-43926.rs:1:22 +error[E0805]: malformed `link` attribute input + --> $DIR/issue-43926.rs:1:1 | LL | #[link(name = "foo", cfg())] - | ^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^-----^^ + | | + | expected a single argument here + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "foo", cfg())] +LL + #[link(name = "...")] + | +LL - #[link(name = "foo", cfg())] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "foo", cfg())] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "foo", cfg())] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0805`. diff --git a/tests/ui/link-native-libs/link-attr-validation-early.rs b/tests/ui/link-native-libs/link-attr-validation-early.rs index a7dd80f8920..89a34ac6ca1 100644 --- a/tests/ui/link-native-libs/link-attr-validation-early.rs +++ b/tests/ui/link-native-libs/link-attr-validation-early.rs @@ -1,8 +1,6 @@ // Top-level ill-formed -#[link] //~ ERROR valid forms for the attribute are - //~| WARN this was previously accepted -#[link = "foo"] //~ ERROR valid forms for the attribute are - //~| WARN this was previously accepted +#[link] //~ ERROR malformed +#[link = "foo"] //~ ERROR malformed extern "C" {} fn main() {} diff --git a/tests/ui/link-native-libs/link-attr-validation-early.stderr b/tests/ui/link-native-libs/link-attr-validation-early.stderr index d4fc2e272f8..e4799b1a161 100644 --- a/tests/ui/link-native-libs/link-attr-validation-early.stderr +++ b/tests/ui/link-native-libs/link-attr-validation-early.stderr @@ -1,47 +1,45 @@ -error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]` +error[E0539]: malformed `link` attribute input --> $DIR/link-attr-validation-early.rs:2:1 | LL | #[link] - | ^^^^^^^ + | ^^^^^^^ expected this to be a list | - = 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> = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> - = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default +help: try changing it to one of the following valid forms of the attribute + | +LL | #[link(name = "...")] + | ++++++++++++++ +LL | #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +LL | #[link(name = "...", kind = "dylib|static|...")] + | +++++++++++++++++++++++++++++++++++++++++ +LL | #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + = and 1 other candidate -error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]` - --> $DIR/link-attr-validation-early.rs:4:1 +error[E0539]: malformed `link` attribute input + --> $DIR/link-attr-validation-early.rs:3:1 | LL | #[link = "foo"] - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^ expected this to be a list | - = 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> = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> - -error: aborting due to 2 previous errors - -Future incompatibility report: Future breakage diagnostic: -error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]` - --> $DIR/link-attr-validation-early.rs:2:1 +help: try changing it to one of the following valid forms of the attribute | -LL | #[link] - | ^^^^^^^ +LL - #[link = "foo"] +LL + #[link(name = "...")] | - = 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> - = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> - = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default - -Future breakage diagnostic: -error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]` - --> $DIR/link-attr-validation-early.rs:4:1 +LL - #[link = "foo"] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] | -LL | #[link = "foo"] - | ^^^^^^^^^^^^^^^ +LL - #[link = "foo"] +LL + #[link(name = "...", kind = "dylib|static|...")] | - = 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> - = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> - = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default +LL - #[link = "foo"] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0539`. diff --git a/tests/ui/link-native-libs/link-attr-validation-late.rs b/tests/ui/link-native-libs/link-attr-validation-late.rs index 4eeb8ba4884..d2947b5f61a 100644 --- a/tests/ui/link-native-libs/link-attr-validation-late.rs +++ b/tests/ui/link-native-libs/link-attr-validation-late.rs @@ -1,38 +1,36 @@ #![feature(link_cfg)] // Top-level ill-formed -#[link(name = "...", "literal")] //~ ERROR unexpected `#[link]` argument -#[link(name = "...", unknown)] //~ ERROR unexpected `#[link]` argument +#[link(name = "...", "literal")] //~ ERROR malformed `link` attribute input +#[link(name = "...", unknown)] //~ ERROR malformed `link` attribute input 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 +#[link(name = "foo", name = "bar")] //~ ERROR malformed `link` attribute input +#[link(name = "...", kind = "dylib", kind = "bar")] //~ ERROR malformed `link` attribute input +#[link(name = "...", modifiers = "+verbatim", modifiers = "bar")] //~ ERROR malformed `link` attribute input +#[link(name = "...", cfg(false), cfg(false))] //~ ERROR malformed `link` attribute input +#[link(wasm_import_module = "foo", wasm_import_module = "bar")] //~ ERROR malformed `link` attribute input 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"` +#[link(name)] //~ ERROR malformed `link` attribute input +#[link(name())] //~ ERROR malformed `link` attribute input +#[link(name = "...", kind)] //~ ERROR malformed `link` attribute input +#[link(name = "...", kind())] //~ ERROR malformed `link` attribute input +#[link(name = "...", modifiers)] //~ ERROR malformed `link` attribute input +#[link(name = "...", modifiers())] //~ ERROR malformed `link` attribute input +#[link(name = "...", cfg)] //~ ERROR malformed `link` attribute input +#[link(name = "...", cfg = "literal")] //~ ERROR malformed `link` attribute input +#[link(name = "...", cfg("literal"))] //~ ERROR `cfg` predicate key must be an identifier +#[link(name = "...", wasm_import_module)] //~ ERROR malformed `link` attribute input +#[link(name = "...", wasm_import_module())] //~ ERROR malformed `link` attribute input 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 = "+unknown")] //~ ERROR malformed `link` attribute input #[link(name = "...", modifiers = "+verbatim,+verbatim")] //~ ERROR multiple `verbatim` modifiers extern "C" {} diff --git a/tests/ui/link-native-libs/link-attr-validation-late.stderr b/tests/ui/link-native-libs/link-attr-validation-late.stderr index f3989c09360..834dca0bc0b 100644 --- a/tests/ui/link-native-libs/link-attr-validation-late.stderr +++ b/tests/ui/link-native-libs/link-attr-validation-late.stderr @@ -1,147 +1,472 @@ -error: unexpected `#[link]` argument, expected one of: name, kind, modifiers, cfg, wasm_import_module, import_name_type - --> $DIR/link-attr-validation-late.rs:4:22 +error[E0565]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:4:1 | LL | #[link(name = "...", "literal")] - | ^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^---------^^ + | | + | didn't expect a literal here + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", "literal")] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", "literal")] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", "literal")] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", "literal")] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: unexpected `#[link]` argument, expected one of: name, kind, modifiers, cfg, wasm_import_module, import_name_type - --> $DIR/link-attr-validation-late.rs:5:22 +error[E0539]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:5:1 | LL | #[link(name = "...", unknown)] - | ^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^-------^^ + | | + | valid arguments are "name", "kind", "modifiers", "cfg", "wasm_import_module" or "import_name_type" + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", unknown)] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", unknown)] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", unknown)] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", unknown)] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: multiple `name` arguments in a single `#[link]` attribute - --> $DIR/link-attr-validation-late.rs:9:22 +error[E0538]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:9:1 | LL | #[link(name = "foo", name = "bar")] - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^------------^^ + | | + | found `name` used as a key more than once + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "foo", name = "bar")] +LL + #[link(name = "...")] + | +LL - #[link(name = "foo", name = "bar")] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "foo", name = "bar")] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "foo", name = "bar")] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: multiple `kind` arguments in a single `#[link]` attribute - --> $DIR/link-attr-validation-late.rs:10:38 +error[E0538]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:10:1 | LL | #[link(name = "...", kind = "dylib", kind = "bar")] - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------^^ + | | + | found `kind` used as a key more than once + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", kind = "dylib", kind = "bar")] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", kind = "dylib", kind = "bar")] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", kind = "dylib", kind = "bar")] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", kind = "dylib", kind = "bar")] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: multiple `modifiers` arguments in a single `#[link]` attribute - --> $DIR/link-attr-validation-late.rs:11:47 +error[E0538]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:11:1 | LL | #[link(name = "...", modifiers = "+verbatim", modifiers = "bar")] - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------^^ + | | + | found `modifiers` used as a key more than once + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", modifiers = "+verbatim", modifiers = "bar")] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", modifiers = "+verbatim", modifiers = "bar")] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", modifiers = "+verbatim", modifiers = "bar")] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", modifiers = "+verbatim", modifiers = "bar")] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: multiple `cfg` arguments in a single `#[link]` attribute - --> $DIR/link-attr-validation-late.rs:12:34 +error[E0538]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:12:1 | LL | #[link(name = "...", cfg(false), cfg(false))] - | ^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------^^ + | | + | found `cfg` used as a key more than once + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", cfg(false), cfg(false))] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", cfg(false), cfg(false))] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", cfg(false), cfg(false))] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", cfg(false), cfg(false))] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: multiple `wasm_import_module` arguments in a single `#[link]` attribute - --> $DIR/link-attr-validation-late.rs:13:36 +error[E0538]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:13:1 | 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:17:8 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--------------------------^^ + | | + | found `wasm_import_module` used as a key more than once | -LL | #[link(name)] - | ^^^^ + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(wasm_import_module = "foo", wasm_import_module = "bar")] +LL + #[link(name = "...")] + | +LL - #[link(wasm_import_module = "foo", wasm_import_module = "bar")] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(wasm_import_module = "foo", wasm_import_module = "bar")] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(wasm_import_module = "foo", wasm_import_module = "bar")] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error[E0459]: `#[link]` attribute requires a `name = "string"` argument +error[E0539]: malformed `link` attribute input --> $DIR/link-attr-validation-late.rs:17:1 | LL | #[link(name)] - | ^^^^^^^^^^^^^ missing `name` argument - -error: link name must be of the form `name = "string"` - --> $DIR/link-attr-validation-late.rs:19:8 + | ^^^^^^^----^^ + | | + | expected this to be of the form `name = "..."` | -LL | #[link(name())] - | ^^^^^^ + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL | #[link(name = "...")] + | +++++++ +LL | #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +LL | #[link(name = "...", kind = "dylib|static|...")] + | ++++++++++++++++++++++++++++++++++ +LL | #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + = and 1 other candidate -error[E0459]: `#[link]` attribute requires a `name = "string"` argument - --> $DIR/link-attr-validation-late.rs:19:1 +error[E0539]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:18:1 | LL | #[link(name())] - | ^^^^^^^^^^^^^^^ missing `name` argument + | ^^^^^^^------^^ + | | + | expected this to be of the form `name = "..."` + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name())] +LL + #[link(name = "...")] + | +LL - #[link(name())] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name())] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name())] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: link kind must be of the form `kind = "string"` - --> $DIR/link-attr-validation-late.rs:21:22 +error[E0539]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:19:1 | LL | #[link(name = "...", kind)] - | ^^^^ + | ^^^^^^^^^^^^^^^^^^^^^----^^ + | | + | expected this to be of the form `kind = "..."` + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", kind)] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", kind)] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL | #[link(name = "...", kind = "dylib|static|...")] + | ++++++++++++++++++++ +LL | #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + = and 1 other candidate -error: link kind must be of the form `kind = "string"` - --> $DIR/link-attr-validation-late.rs:22:22 +error[E0539]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:20:1 | LL | #[link(name = "...", kind())] - | ^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^------^^ + | | + | expected this to be of the form `kind = "..."` + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", kind())] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", kind())] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", kind())] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", kind())] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: link modifiers must be of the form `modifiers = "string"` - --> $DIR/link-attr-validation-late.rs:23:22 +error[E0539]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:21:1 | LL | #[link(name = "...", modifiers)] - | ^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^---------^^ + | | + | expected this to be of the form `modifiers = "..."` + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", modifiers)] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", modifiers)] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", modifiers)] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", modifiers)] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: link modifiers must be of the form `modifiers = "string"` - --> $DIR/link-attr-validation-late.rs:24:22 +error[E0539]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:22:1 | LL | #[link(name = "...", modifiers())] - | ^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^-----------^^ + | | + | expected this to be of the form `modifiers = "..."` + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", modifiers())] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", modifiers())] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", modifiers())] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", modifiers())] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: link cfg must be of the form `cfg(/* predicate */)` - --> $DIR/link-attr-validation-late.rs:25:22 +error[E0539]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:23:1 | LL | #[link(name = "...", cfg)] - | ^^^ + | ^^^^^^^^^^^^^^^^^^^^^---^^ + | | + | expected this to be a list + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", cfg)] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", cfg)] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", cfg)] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", cfg)] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: link cfg must be of the form `cfg(/* predicate */)` - --> $DIR/link-attr-validation-late.rs:26:22 +error[E0539]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:24:1 | LL | #[link(name = "...", cfg = "literal")] - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^---------------^^ + | | + | expected this to be a list + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", cfg = "literal")] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", cfg = "literal")] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", cfg = "literal")] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", cfg = "literal")] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: link cfg must have a single predicate argument - --> $DIR/link-attr-validation-late.rs:27:22 +error: `cfg` predicate key must be an identifier + --> $DIR/link-attr-validation-late.rs:25:26 | LL | #[link(name = "...", cfg("literal"))] - | ^^^^^^^^^^^^^^ + | ^^^^^^^^^ -error: wasm import module must be of the form `wasm_import_module = "string"` - --> $DIR/link-attr-validation-late.rs:28:22 +error[E0539]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:26:1 | LL | #[link(name = "...", wasm_import_module)] - | ^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^------------------^^ + | | + | expected this to be of the form `wasm_import_module = "..."` + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", wasm_import_module)] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", wasm_import_module)] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", wasm_import_module)] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", wasm_import_module)] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: wasm import module must be of the form `wasm_import_module = "string"` - --> $DIR/link-attr-validation-late.rs:29:22 +error[E0539]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:27:1 | LL | #[link(name = "...", wasm_import_module())] - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^--------------------^^ + | | + | expected this to be of the form `wasm_import_module = "..."` + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", wasm_import_module())] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", wasm_import_module())] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", wasm_import_module())] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", wasm_import_module())] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate error: invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed - --> $DIR/link-attr-validation-late.rs:33:34 + --> $DIR/link-attr-validation-late.rs:31: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:34:34 + --> $DIR/link-attr-validation-late.rs:32: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:35:34 +error[E0539]: malformed `link` attribute input + --> $DIR/link-attr-validation-late.rs:33:1 | LL | #[link(name = "...", modifiers = "+unknown")] - | ^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------^^ + | | + | valid arguments are "bundle", "verbatim", "whole-archive" or "as-needed" + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", modifiers = "+unknown")] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", modifiers = "+unknown")] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", modifiers = "+unknown")] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", modifiers = "+unknown")] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate error: multiple `verbatim` modifiers in a single `modifiers` argument - --> $DIR/link-attr-validation-late.rs:36:34 + --> $DIR/link-attr-validation-late.rs:34:34 | LL | #[link(name = "...", modifiers = "+verbatim,+verbatim")] | ^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 24 previous errors +error: aborting due to 22 previous errors -For more information about this error, try `rustc --explain E0459`. +Some errors have detailed explanations: E0538, E0539, E0565. +For more information about an error, try `rustc --explain E0538`. diff --git a/tests/ui/link-native-libs/modifiers-override-4.rs b/tests/ui/link-native-libs/modifiers-override-4.rs new file mode 100644 index 00000000000..cc5b07e20cc --- /dev/null +++ b/tests/ui/link-native-libs/modifiers-override-4.rs @@ -0,0 +1,12 @@ +#[link(name = "foo")] +#[link( +//~^ ERROR malformed `link` attribute input + name = "bar", + kind = "static", + modifiers = "+whole-archive,-whole-archive", + //~^ ERROR multiple `whole-archive` modifiers in a single `modifiers` argument + modifiers = "+bundle" +)] +extern "C" {} + +fn main() {} diff --git a/tests/ui/link-native-libs/modifiers-override-4.stderr b/tests/ui/link-native-libs/modifiers-override-4.stderr new file mode 100644 index 00000000000..317e89cb39c --- /dev/null +++ b/tests/ui/link-native-libs/modifiers-override-4.stderr @@ -0,0 +1,67 @@ +error[E0538]: malformed `link` attribute input + --> $DIR/modifiers-override-4.rs:2:1 + | +LL | / #[link( +LL | | +LL | | name = "bar", +LL | | kind = "static", +... | +LL | | modifiers = "+bundle" + | | --------------------- found `modifiers` used as a key more than once +LL | | )] + | |__^ + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link( +LL - +LL - name = "bar", +LL - kind = "static", +LL - modifiers = "+whole-archive,-whole-archive", +LL - +LL - modifiers = "+bundle" +LL - )] +LL + #[link(name = "...")] + | +LL - #[link( +LL - +LL - name = "bar", +LL - kind = "static", +LL - modifiers = "+whole-archive,-whole-archive", +LL - +LL - modifiers = "+bundle" +LL - )] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link( +LL - +LL - name = "bar", +LL - kind = "static", +LL - modifiers = "+whole-archive,-whole-archive", +LL - +LL - modifiers = "+bundle" +LL - )] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link( +LL - +LL - name = "bar", +LL - kind = "static", +LL - modifiers = "+whole-archive,-whole-archive", +LL - +LL - modifiers = "+bundle" +LL - )] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate + +error: multiple `whole-archive` modifiers in a single `modifiers` argument + --> $DIR/modifiers-override-4.rs:6:17 + | +LL | modifiers = "+whole-archive,-whole-archive", + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0538`. diff --git a/tests/ui/link-native-libs/modifiers-override.rs b/tests/ui/link-native-libs/modifiers-override.rs index cd2d003664a..a44b7d37ed8 100644 --- a/tests/ui/link-native-libs/modifiers-override.rs +++ b/tests/ui/link-native-libs/modifiers-override.rs @@ -4,13 +4,8 @@ #[link( name = "bar", kind = "static", - modifiers = "+whole-archive,-whole-archive", - //~^ ERROR multiple `whole-archive` modifiers in a single `modifiers` argument - modifiers = "+bundle" - //~^ ERROR multiple `modifiers` arguments in a single `#[link]` attribute )] extern "C" {} //~^ ERROR overriding linking modifiers from command line is not supported -//~| ERROR overriding linking modifiers from command line is not supported fn main() {} diff --git a/tests/ui/link-native-libs/modifiers-override.stderr b/tests/ui/link-native-libs/modifiers-override.stderr index 64427651e9f..3cc99c96c7c 100644 --- a/tests/ui/link-native-libs/modifiers-override.stderr +++ b/tests/ui/link-native-libs/modifiers-override.stderr @@ -1,28 +1,8 @@ -error: multiple `modifiers` arguments in a single `#[link]` attribute - --> $DIR/modifiers-override.rs:9:5 - | -LL | modifiers = "+bundle" - | ^^^^^^^^^^^^^^^^^^^^^ - -error: multiple `whole-archive` modifiers in a single `modifiers` argument - --> $DIR/modifiers-override.rs:7:17 - | -LL | modifiers = "+whole-archive,-whole-archive", - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: overriding linking modifiers from command line is not supported - --> $DIR/modifiers-override.rs:12:1 - | -LL | extern "C" {} - | ^^^^^^^^^^^^^ - error: overriding linking modifiers from command line is not supported - --> $DIR/modifiers-override.rs:12:1 + --> $DIR/modifiers-override.rs:8:1 | LL | extern "C" {} | ^^^^^^^^^^^^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 4 previous errors +error: aborting due to 1 previous error diff --git a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-invalid-format.rs b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-invalid-format.rs index 50ad8a173ad..542f34b3eb1 100644 --- a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-invalid-format.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-invalid-format.rs @@ -1,7 +1,10 @@ -//@ only-windows -//@ only-x86 +//@ add-core-stubs +//@ compile-flags: --target i686-pc-windows-msvc +//@ needs-llvm-components: x86 +#![feature(no_core, rustc_attrs, lang_items)] +#![no_core] +#![crate_type = "lib"] + #[link(name = "foo", kind = "raw-dylib", import_name_type = 6)] -//~^ ERROR import name type must be of the form `import_name_type = "string"` +//~^ ERROR malformed extern "C" { } - -fn main() {} diff --git a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-invalid-format.stderr b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-invalid-format.stderr index d2cf7a0ba1f..6121762fb03 100644 --- a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-invalid-format.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-invalid-format.stderr @@ -1,8 +1,28 @@ -error: import name type must be of the form `import_name_type = "string"` - --> $DIR/import-name-type-invalid-format.rs:3:42 +error[E0539]: malformed `link` attribute input + --> $DIR/import-name-type-invalid-format.rs:8:1 | LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = 6)] - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--------------------^^ + | | + | expected this to be of the form `import_name_type = "..."` + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "foo", kind = "raw-dylib", import_name_type = 6)] +LL + #[link(name = "...")] + | +LL - #[link(name = "foo", kind = "raw-dylib", import_name_type = 6)] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "foo", kind = "raw-dylib", import_name_type = 6)] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "foo", kind = "raw-dylib", import_name_type = 6)] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0539`. diff --git a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-multiple.rs b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-multiple.rs index cf456b9b261..e2418642aea 100644 --- a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-multiple.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-multiple.rs @@ -1,8 +1,11 @@ // ignore-tidy-linelength -//@ only-windows -//@ only-x86 +//@ add-core-stubs +//@ compile-flags: --target i686-pc-windows-msvc +//@ needs-llvm-components: x86 +#![feature(no_core, rustc_attrs, lang_items)] +#![no_core] +#![crate_type = "lib"] + #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated", import_name_type = "decorated")] -//~^ ERROR multiple `import_name_type` arguments in a single `#[link]` attribute +//~^ ERROR malformed extern "C" { } - -fn main() {} diff --git a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-multiple.stderr b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-multiple.stderr index 8e65baf65df..adfe915b464 100644 --- a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-multiple.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-multiple.stderr @@ -1,8 +1,28 @@ -error: multiple `import_name_type` arguments in a single `#[link]` attribute - --> $DIR/import-name-type-multiple.rs:4:74 +error[E0538]: malformed `link` attribute input + --> $DIR/import-name-type-multiple.rs:9:1 | LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated", import_name_type = "decorated")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------^^ + | | + | found `import_name_type` used as a key more than once + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated", import_name_type = "decorated")] +LL + #[link(name = "...")] + | +LL - #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated", import_name_type = "decorated")] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated", import_name_type = "decorated")] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated", import_name_type = "decorated")] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0538`. diff --git a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unknown-value.rs b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unknown-value.rs index b3859ba1ce6..174e8682f29 100644 --- a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unknown-value.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unknown-value.rs @@ -1,7 +1,10 @@ -//@ only-windows -//@ only-x86 +//@ add-core-stubs +//@ compile-flags: --target i686-pc-windows-msvc +//@ needs-llvm-components: x86 +#![feature(no_core, rustc_attrs, lang_items)] +#![no_core] +#![crate_type = "lib"] + #[link(name = "foo", kind = "raw-dylib", import_name_type = "unknown")] -//~^ ERROR unknown import name type `unknown`, expected one of: decorated, noprefix, undecorated +//~^ ERROR malformed extern "C" { } - -fn main() {} diff --git a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unknown-value.stderr b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unknown-value.stderr index 4b8b90eb6e2..fc24a6bed17 100644 --- a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unknown-value.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unknown-value.stderr @@ -1,8 +1,28 @@ -error: unknown import name type `unknown`, expected one of: decorated, noprefix, undecorated - --> $DIR/import-name-type-unknown-value.rs:3:42 +error[E0539]: malformed `link` attribute input + --> $DIR/import-name-type-unknown-value.rs:8:1 | LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = "unknown")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------^^ + | | + | valid arguments are "decorated", "noprefix" or "undecorated" + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "foo", kind = "raw-dylib", import_name_type = "unknown")] +LL + #[link(name = "...")] + | +LL - #[link(name = "foo", kind = "raw-dylib", import_name_type = "unknown")] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "foo", kind = "raw-dylib", import_name_type = "unknown")] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "foo", kind = "raw-dylib", import_name_type = "unknown")] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0539`. diff --git a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unsupported-link-kind.rs b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unsupported-link-kind.rs index 3ead5cb1fd7..ca6aef79c95 100644 --- a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unsupported-link-kind.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unsupported-link-kind.rs @@ -1,5 +1,10 @@ -//@ only-windows -//@ only-x86 +//@ add-core-stubs +//@ compile-flags: --target i686-pc-windows-msvc +//@ needs-llvm-components: x86 +#![feature(no_core, rustc_attrs, lang_items)] +#![no_core] +#![crate_type = "lib"] + #[link(name = "foo", import_name_type = "decorated")] //~^ ERROR import name type can only be used with link kind `raw-dylib` extern "C" { } @@ -11,5 +16,3 @@ extern "C" { } // Specifying `import_name_type` before `kind` shouldn't raise an error. #[link(name = "bar", import_name_type = "decorated", kind = "raw-dylib")] extern "C" { } - -fn main() {} diff --git a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unsupported-link-kind.stderr b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unsupported-link-kind.stderr index 75cadc471c4..075e4ffffb8 100644 --- a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unsupported-link-kind.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-unsupported-link-kind.stderr @@ -1,11 +1,11 @@ error: import name type can only be used with link kind `raw-dylib` - --> $DIR/import-name-type-unsupported-link-kind.rs:3:22 + --> $DIR/import-name-type-unsupported-link-kind.rs:8:22 | LL | #[link(name = "foo", import_name_type = "decorated")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: import name type can only be used with link kind `raw-dylib` - --> $DIR/import-name-type-unsupported-link-kind.rs:7:39 + --> $DIR/import-name-type-unsupported-link-kind.rs:12:39 | LL | #[link(name = "bar", kind = "static", import_name_type = "decorated")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-x86-only.rs b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-x86-only.rs index ab0dcda64e6..5f1410f7d2a 100644 --- a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-x86-only.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-x86-only.rs @@ -1,7 +1,10 @@ -//@ only-windows -//@ ignore-x86 +//@ add-core-stubs +//@ compile-flags: --target aarch64-pc-windows-msvc +//@ needs-llvm-components: aarch64 +#![feature(no_core, rustc_attrs, lang_items)] +#![no_core] +#![crate_type = "lib"] + #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated")] //~^ ERROR import name type is only supported on x86 extern "C" { } - -fn main() {} diff --git a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-x86-only.stderr b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-x86-only.stderr index 757f1f7994e..ad3b9f79c84 100644 --- a/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-x86-only.stderr +++ b/tests/ui/linkage-attr/raw-dylib/windows/import-name-type-x86-only.stderr @@ -1,5 +1,5 @@ error: import name type is only supported on x86 - --> $DIR/import-name-type-x86-only.rs:3:42 + --> $DIR/import-name-type-x86-only.rs:8:42 | LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-not-foreign-fn.rs b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-not-foreign-fn.rs index 301e690be38..8651a4e7175 100644 --- a/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-not-foreign-fn.rs +++ b/tests/ui/linkage-attr/raw-dylib/windows/link-ordinal-not-foreign-fn.rs @@ -10,7 +10,7 @@ fn test() {} //~^ ERROR attribute cannot be used on static mut imported_val: i32 = 123; -#[link(name = "exporter", kind = "raw-dylib")] +#[link(name = "exporter")] extern "C" { #[link_ordinal(13)] fn imported_function(); diff --git a/tests/ui/malformed/malformed-regressions.rs b/tests/ui/malformed/malformed-regressions.rs index 99f0fc904a9..407920c4e4e 100644 --- a/tests/ui/malformed/malformed-regressions.rs +++ b/tests/ui/malformed/malformed-regressions.rs @@ -4,9 +4,7 @@ //~^ WARN this was previously accepted #[inline = ""] //~ ERROR valid forms for the attribute are //~^ WARN this was previously accepted -#[link] //~ ERROR valid forms for the attribute are -//~^ WARN this was previously accepted -#[link = ""] //~ ERROR valid forms for the attribute are -//~^ WARN this was previously accepted +#[link] //~ ERROR malformed +#[link = ""] //~ ERROR malformed fn main() {} diff --git a/tests/ui/malformed/malformed-regressions.stderr b/tests/ui/malformed/malformed-regressions.stderr index cab347a8062..850bcb6cbc2 100644 --- a/tests/ui/malformed/malformed-regressions.stderr +++ b/tests/ui/malformed/malformed-regressions.stderr @@ -9,25 +9,47 @@ LL | #[doc] = note: for more information, visit <https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html> = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default -error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]` +error[E0539]: malformed `link` attribute input --> $DIR/malformed-regressions.rs:7:1 | LL | #[link] - | ^^^^^^^ + | ^^^^^^^ expected this to be a list | - = 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> = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL | #[link(name = "...")] + | ++++++++++++++ +LL | #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +LL | #[link(name = "...", kind = "dylib|static|...")] + | +++++++++++++++++++++++++++++++++++++++++ +LL | #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + = and 1 other candidate -error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]` - --> $DIR/malformed-regressions.rs:9:1 +error[E0539]: malformed `link` attribute input + --> $DIR/malformed-regressions.rs:8:1 | LL | #[link = ""] - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^ expected this to be a list | - = 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> = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link = ""] +LL + #[link(name = "...")] + | +LL - #[link = ""] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link = ""] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link = ""] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` --> $DIR/malformed-regressions.rs:3:1 @@ -49,6 +71,7 @@ LL | #[inline = ""] error: aborting due to 5 previous errors +For more information about this error, try `rustc --explain E0539`. Future incompatibility report: Future breakage diagnostic: error: valid forms for the attribute are `#[doc(hidden)]`, `#[doc(inline)]`, and `#[doc = "string"]` --> $DIR/malformed-regressions.rs:1:1 @@ -62,30 +85,6 @@ LL | #[doc] = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: -error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]` - --> $DIR/malformed-regressions.rs:7:1 - | -LL | #[link] - | ^^^^^^^ - | - = 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> - = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> - = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default - -Future breakage diagnostic: -error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]` - --> $DIR/malformed-regressions.rs:9:1 - | -LL | #[link = ""] - | ^^^^^^^^^^^^ - | - = 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> - = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> - = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default - -Future breakage diagnostic: error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` --> $DIR/malformed-regressions.rs:3:1 | diff --git a/tests/ui/parser/bad-lit-suffixes.rs b/tests/ui/parser/bad-lit-suffixes.rs index 0a01bb84f01..91b32fd4539 100644 --- a/tests/ui/parser/bad-lit-suffixes.rs +++ b/tests/ui/parser/bad-lit-suffixes.rs @@ -38,6 +38,7 @@ fn g() {} #[link(name = "string"suffix)] //~^ ERROR suffixes on string literals are invalid +//~| ERROR malformed `link` attribute input extern "C" {} #[rustc_layout_scalar_valid_range_start(0suffix)] diff --git a/tests/ui/parser/bad-lit-suffixes.stderr b/tests/ui/parser/bad-lit-suffixes.stderr index e1a8a6834f4..217cc74b8eb 100644 --- a/tests/ui/parser/bad-lit-suffixes.stderr +++ b/tests/ui/parser/bad-lit-suffixes.stderr @@ -10,12 +10,6 @@ error: suffixes on string literals are invalid LL | "C"suffix | ^^^^^^^^^ invalid suffix `suffix` -error: suffixes on string literals are invalid - --> $DIR/bad-lit-suffixes.rs:39:15 - | -LL | #[link(name = "string"suffix)] - | ^^^^^^^^^^^^^^ invalid suffix `suffix` - warning: `extern` declarations without an explicit ABI are deprecated --> $DIR/bad-lit-suffixes.rs:3:1 | @@ -160,8 +154,39 @@ LL - #[must_use = "string"suffix] LL + #[must_use] | +error: suffixes on string literals are invalid + --> $DIR/bad-lit-suffixes.rs:39:15 + | +LL | #[link(name = "string"suffix)] + | ^^^^^^^^^^^^^^ invalid suffix `suffix` + +error[E0539]: malformed `link` attribute input + --> $DIR/bad-lit-suffixes.rs:39:1 + | +LL | #[link(name = "string"suffix)] + | ^^^^^^^---------------------^^ + | | + | expected this to be of the form `name = "..."` + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "string"suffix)] +LL + #[link(name = "...")] + | +LL - #[link(name = "string"suffix)] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "string"suffix)] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "string"suffix)] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate + error: invalid suffix `suffix` for number literal - --> $DIR/bad-lit-suffixes.rs:43:41 + --> $DIR/bad-lit-suffixes.rs:44:41 | LL | #[rustc_layout_scalar_valid_range_start(0suffix)] | ^^^^^^^ invalid suffix `suffix` @@ -169,7 +194,7 @@ LL | #[rustc_layout_scalar_valid_range_start(0suffix)] = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) error[E0539]: malformed `rustc_layout_scalar_valid_range_start` attribute input - --> $DIR/bad-lit-suffixes.rs:43:1 + --> $DIR/bad-lit-suffixes.rs:44:1 | LL | #[rustc_layout_scalar_valid_range_start(0suffix)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------^^ @@ -177,6 +202,6 @@ LL | #[rustc_layout_scalar_valid_range_start(0suffix)] | | expected an integer literal here | help: must be of the form: `#[rustc_layout_scalar_valid_range_start(start)]` -error: aborting due to 22 previous errors; 2 warnings emitted +error: aborting due to 23 previous errors; 2 warnings emitted For more information about this error, try `rustc --explain E0539`. diff --git a/tests/ui/wasm/wasm-import-module.rs b/tests/ui/wasm/wasm-import-module.rs index 2b3bca9a411..c38fcb1a000 100644 --- a/tests/ui/wasm/wasm-import-module.rs +++ b/tests/ui/wasm/wasm-import-module.rs @@ -1,12 +1,12 @@ #![feature(link_cfg)] -#[link(name = "...", wasm_import_module)] //~ ERROR: must be of the form +#[link(name = "...", wasm_import_module)] //~ ERROR: malformed `link` attribute input extern "C" {} -#[link(name = "...", wasm_import_module(x))] //~ ERROR: must be of the form +#[link(name = "...", wasm_import_module(x))] //~ ERROR: malformed `link` attribute input extern "C" {} -#[link(name = "...", wasm_import_module())] //~ ERROR: must be of the form +#[link(name = "...", wasm_import_module())] //~ ERROR: malformed `link` attribute input extern "C" {} #[link(wasm_import_module = "foo", name = "bar")] //~ ERROR: `wasm_import_module` is incompatible with other arguments diff --git a/tests/ui/wasm/wasm-import-module.stderr b/tests/ui/wasm/wasm-import-module.stderr index 84f437941a7..f5ea449839b 100644 --- a/tests/ui/wasm/wasm-import-module.stderr +++ b/tests/ui/wasm/wasm-import-module.stderr @@ -1,20 +1,77 @@ -error: wasm import module must be of the form `wasm_import_module = "string"` - --> $DIR/wasm-import-module.rs:3:22 +error[E0539]: malformed `link` attribute input + --> $DIR/wasm-import-module.rs:3:1 | LL | #[link(name = "...", wasm_import_module)] - | ^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^------------------^^ + | | + | expected this to be of the form `wasm_import_module = "..."` + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", wasm_import_module)] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", wasm_import_module)] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", wasm_import_module)] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", wasm_import_module)] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: wasm import module must be of the form `wasm_import_module = "string"` - --> $DIR/wasm-import-module.rs:6:22 +error[E0539]: malformed `link` attribute input + --> $DIR/wasm-import-module.rs:6:1 | LL | #[link(name = "...", wasm_import_module(x))] - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^---------------------^^ + | | + | expected this to be of the form `wasm_import_module = "..."` + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", wasm_import_module(x))] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", wasm_import_module(x))] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", wasm_import_module(x))] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", wasm_import_module(x))] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate -error: wasm import module must be of the form `wasm_import_module = "string"` - --> $DIR/wasm-import-module.rs:9:22 +error[E0539]: malformed `link` attribute input + --> $DIR/wasm-import-module.rs:9:1 | LL | #[link(name = "...", wasm_import_module())] - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^--------------------^^ + | | + | expected this to be of the form `wasm_import_module = "..."` + | + = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute> +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link(name = "...", wasm_import_module())] +LL + #[link(name = "...")] + | +LL - #[link(name = "...", wasm_import_module())] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link(name = "...", wasm_import_module())] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link(name = "...", wasm_import_module())] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate error: `wasm_import_module` is incompatible with other arguments in `#[link]` attributes --> $DIR/wasm-import-module.rs:12:8 @@ -36,3 +93,4 @@ LL | #[link(wasm_import_module = "foo", cfg(false))] error: aborting due to 6 previous errors +For more information about this error, try `rustc --explain E0539`. |
