rust/tests/ui/attributes/unsafe/proc-unsafe-attributes.stderr
Esteban Küber 189f264926 Allow attr entries to declare list of alternatives for List and NamedValueStr
Modify `AttributeTemplate` to support list of alternatives for list and name value attribute styles.

Suggestions now provide more correct suggested code:

```
error[E0805]: malformed `used` attribute input
  --> $DIR/used_with_multi_args.rs:3:1
   |
LL | #[used(compiler, linker)]
   | ^^^^^^------------------^
   |       |
   |       expected a single argument here
   |
help: try changing it to one of the following valid forms of the attribute
   |
LL - #[used(compiler, linker)]
LL + #[used(compiler)]
   |
LL - #[used(compiler, linker)]
LL + #[used(linker)]
   |
LL - #[used(compiler, linker)]
LL + #[used]
   |
```

instead of the prior "masking" of the lack of this feature by suggesting pipe-separated lists:

```
error[E0805]: malformed `used` attribute input
  --> $DIR/used_with_multi_args.rs:3:1
   |
LL | #[used(compiler, linker)]
   | ^^^^^^------------------^
   |       |
   |       expected a single argument here
   |
help: try changing it to one of the following valid forms of the attribute
   |
LL - #[used(compiler, linker)]
LL + #[used(compiler|linker)]
   |
LL - #[used(compiler, linker)]
LL + #[used]
   |
```
2025-08-11 16:00:49 +00:00

154 lines
4.9 KiB
Plaintext

error[E0452]: malformed lint attribute input
--> $DIR/proc-unsafe-attributes.rs:27:16
|
LL | #[unsafe(allow(unsafe(dead_code)))]
| ^^^^^^^^^^^^^^^^^ bad attribute argument
error[E0452]: malformed lint attribute input
--> $DIR/proc-unsafe-attributes.rs:27:16
|
LL | #[unsafe(allow(unsafe(dead_code)))]
| ^^^^^^^^^^^^^^^^^ bad attribute argument
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `proc_macro` is not an unsafe attribute
--> $DIR/proc-unsafe-attributes.rs:1:3
|
LL | #[unsafe(proc_macro)]
| ^^^^^^ this is not an unsafe attribute
|
= note: extraneous unsafe is not allowed in attributes
error: `proc_macro_derive` is not an unsafe attribute
--> $DIR/proc-unsafe-attributes.rs:7:3
|
LL | #[unsafe(proc_macro_derive(Foo))]
| ^^^^^^ this is not an unsafe attribute
|
= note: extraneous unsafe is not allowed in attributes
error: expected identifier, found keyword `unsafe`
--> $DIR/proc-unsafe-attributes.rs:12:21
|
LL | #[proc_macro_derive(unsafe(Foo))]
| ^^^^^^ expected identifier, found keyword
|
help: escape `unsafe` to use it as an identifier
|
LL | #[proc_macro_derive(r#unsafe(Foo))]
| ++
error: `proc_macro_attribute` is not an unsafe attribute
--> $DIR/proc-unsafe-attributes.rs:18:3
|
LL | #[unsafe(proc_macro_attribute)]
| ^^^^^^ this is not an unsafe attribute
|
= note: extraneous unsafe is not allowed in attributes
error: `allow` is not an unsafe attribute
--> $DIR/proc-unsafe-attributes.rs:23:3
|
LL | #[unsafe(allow(dead_code))]
| ^^^^^^ this is not an unsafe attribute
|
= note: extraneous unsafe is not allowed in attributes
error: `allow` is not an unsafe attribute
--> $DIR/proc-unsafe-attributes.rs:27:3
|
LL | #[unsafe(allow(unsafe(dead_code)))]
| ^^^^^^ this is not an unsafe attribute
|
= note: extraneous unsafe is not allowed in attributes
error: expected identifier, found keyword `unsafe`
--> $DIR/proc-unsafe-attributes.rs:27:16
|
LL | #[unsafe(allow(unsafe(dead_code)))]
| ^^^^^^ expected identifier, found keyword
|
help: escape `unsafe` to use it as an identifier
|
LL | #[unsafe(allow(r#unsafe(dead_code)))]
| ++
error: the `#[proc_macro]` attribute is only usable with crates of the `proc-macro` crate type
--> $DIR/proc-unsafe-attributes.rs:1:1
|
LL | #[unsafe(proc_macro)]
| ^^^^^^^^^^^^^^^^^^^^^
error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type
--> $DIR/proc-unsafe-attributes.rs:7:1
|
LL | #[unsafe(proc_macro_derive(Foo))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type
--> $DIR/proc-unsafe-attributes.rs:12:1
|
LL | #[proc_macro_derive(unsafe(Foo))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the `#[proc_macro_attribute]` attribute is only usable with crates of the `proc-macro` crate type
--> $DIR/proc-unsafe-attributes.rs:18:1
|
LL | #[unsafe(proc_macro_attribute)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0452]: malformed lint attribute input
--> $DIR/proc-unsafe-attributes.rs:27:16
|
LL | #[unsafe(allow(unsafe(dead_code)))]
| ^^^^^^^^^^^^^^^^^ bad attribute argument
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0452]: malformed lint attribute input
--> $DIR/proc-unsafe-attributes.rs:27:16
|
LL | #[unsafe(allow(unsafe(dead_code)))]
| ^^^^^^^^^^^^^^^^^ bad attribute argument
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0565]: malformed `proc_macro_derive` attribute input
--> $DIR/proc-unsafe-attributes.rs:12:1
|
LL | #[proc_macro_derive(unsafe(Foo))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^-----^^
| |
| didn't expect any arguments here
|
help: try changing it to one of the following valid forms of the attribute
|
LL - #[proc_macro_derive(unsafe(Foo))]
LL + #[proc_macro_derive(TraitName)]
|
LL - #[proc_macro_derive(unsafe(Foo))]
LL + #[proc_macro_derive(TraitName, attributes(name1, name2, ...))]
|
error[E0452]: malformed lint attribute input
--> $DIR/proc-unsafe-attributes.rs:27:16
|
LL | #[unsafe(allow(unsafe(dead_code)))]
| ^^^^^^^^^^^^^^^^^ bad attribute argument
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0452]: malformed lint attribute input
--> $DIR/proc-unsafe-attributes.rs:27:16
|
LL | #[unsafe(allow(unsafe(dead_code)))]
| ^^^^^^^^^^^^^^^^^ bad attribute argument
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 18 previous errors
Some errors have detailed explanations: E0452, E0565.
For more information about an error, try `rustc --explain E0452`.