Skip to content

unsafe: Bad diagnostic message  #90880

Closed

Description

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"

Activity

  1. ghost added
    A-diagnosticsArea: Messages for errors, warnings, and lints
    on Nov 13, 2021
  2. ghost added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Nov 13, 2021
  3. added
    A-parserArea: The lexing & parsing of Rust source code to an AST
    C-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.
    on Nov 16, 2021
  4. terrarier2111 commented on Nov 16, 2021

    @terrarier2111
    Contributor

    @rustbot claim

  5. added a commit that references this issue on Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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