-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed as not planned
Closed as not planned
Copy link
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-edition-2024Area: The 2024 editionArea: The 2024 editionA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Code
safe unsafe extern "C" fn foo() {
// ...
}
Current output
help: unsafe comes before safe: `unsafe safe`
Desired output
error: safe is invalid outside of `unsafe extern` blocks
help: extern functions are safe by default
Rationale and extra context
this is a follow-up to my previous issue #133586, for more info you can visit it or see the PR (#133618 (closed))
Other cases
unsafe safe extern "C" fn foo() {} // safe is recognised as an identifier, and suggests putting a block around it
Rust Version
rustc 1.82.0 (f6e511eec 2024-10-15)
binary: rustc
commit-hash: f6e511eec7342f59a25f7c0534f1dbea00d01b14
commit-date: 2024-10-15
host: x86_64-unknown-linux-gnu
release: 1.82.0
LLVM version: 19.1.1
Anything else?
The same happens with nightly releases
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-edition-2024Area: The 2024 editionArea: The 2024 editionA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.