Skip to content

unsafe: Bad diagnostic message  #90880

Closed
@b-NC

Description

@b-NC

Given the following code:

pub extern "C" unsafe fn test() {}

The current output is:

error: expected `{`, found keyword `unsafe`
  --> tests/syscalls.rs:14:16
   |
14 | pub extern "C" unsafe fn test() {}
   |                ^^^^^^ expected `{`

Ideally the output should look like:

error: wrongfully placed unsafe keyword
  --> tests/syscalls.rs:14:16
   |
14 | pub extern "C" unsafe fn test() {}
   |                ^^^^ "Move after access specifier"

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTC-enhancementCategory: An issue proposing an enhancement or a PR with one.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions