Skip to content

Wrong suggestion: remove the qualifiers: fn #78941

Closed
@DutchGhost

Description

@DutchGhost

When declaring extern functions with any qualifier (async, const, unsafe) like down below, rustc incorrectly suggests to remove the qualifier fn

extern "C" {
    async fn calleth();
}

The error message

error: functions in `extern` blocks cannot have qualifiers
 --> src/lib.rs:2:14
  |
1 | extern "C" {
  | ---------- in this `extern` block
2 |     async fn calleth();
  |     ---------^^^^^^^
  |     |
  |     help: remove the qualifiers: `fn`

error: aborting due to previous error

error: could not compile `playground`

To learn more, run the command again with --verbose.

Metadata

Metadata

Labels

A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`C-bugCategory: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.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