Code
#[unsafe(nonexistent)]
fn foo() {}
Current output
error: `nonexistent` is not an unsafe attribute
--> src/lib.rs:1:3
|
1 | #[unsafe(nonexistent)]
| ^^^^^^ this is not an unsafe attribute
|
= note: extraneous unsafe is not allowed in attributes
error: cannot find attribute `nonexistent` in this scope
--> src/lib.rs:1:10
|
1 | #[unsafe(nonexistent)]
| ^^^^^^^^^^^
Desired output
error: cannot find attribute `nonexistent` in this scope
--> src/lib.rs:1:10
|
1 | #[unsafe(nonexistent)]
| ^^^^^^^^^^^
Rationale and extra context
While it is true that an attribute that doesn't exist isn't unsafe, the diagnostic provides not much to no additional value, and is emitted first, pushing the real error down. If both diagnostics should be kept, the one about the attribute not existing should probably be emitted first.
Other cases
Rust Version
rustc 1.91.0, on the Playground
Anything else?
No response
Code
Current output
Desired output
Rationale and extra context
While it is true that an attribute that doesn't exist isn't unsafe, the diagnostic provides not much to no additional value, and is emitted first, pushing the real error down. If both diagnostics should be kept, the one about the attribute not existing should probably be emitted first.
Other cases
Rust Version
rustc 1.91.0, on the Playground
Anything else?
No response