- Notifications
You must be signed in to change notification settings - Fork 13.8k
Closed
Closed
Copy link
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-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
type FOO = const async fn();
Current output
error: an `fn` pointer type cannot be `const` --> src/main.rs:1:12 | 1 | type FOO = const async fn(); | -----^^^^^^^^^^^ | | | `const` because of this | help: remove the `const` qualifier | 1 - type FOO = const async fn(); 1 + type FOO = async fn(); | error: an `fn` pointer type cannot be `async` --> src/main.rs:1:12 | 1 | type FOO = const async fn(); | ^^^^^^-----^^^^^ | | | `async` because of this | help: remove the `async` qualifier | 1 - type FOO = const async fn(); 1 + type FOO = const fn(); |
Desired output
1 - type FOO = const async fn(); 1 + type FOO = async fn(); ... 1 - type FOO = const async fn(); 1 + type FOO = const fn();
Rationale and extra context
The suggestion of the current output produces an extra whitespace for each invalid qualifier.
type FOO = fn();
Ideally, the desired output should fully remove the qualifier and following whitespaces up until the next token.
type FOO = fn();
Other cases
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?
No response
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-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.