Open
Description
Code
// This is the only one i've found for now
async const FOO: () = ();
Current output
error: expected one of `extern`, `fn`, `gen`, `safe`, or `unsafe`, found keyword `const`
--> src/main.rs:8:7
|
8 | async const FOO: () = ();
| ------^^^^^
| | |
| | expected one of `extern`, `fn`, `gen`, `safe`, or `unsafe`
| help: `const` must come before `async`: `const async`
|
= note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`
Desired output
error: expected one of `fn`, `gen`, `unsafe`, ..., found keyword `const`
--> src/main.rs:8:7
|
8 | async const FOO: () = ();
| ------^^^^^
| | |
| | unexpected item
= note: constants cannot be `async`
Rationale and extra context
this is meant to be a more general version of #134580
as opposed to #134580, however, this does not apply to const async
, which is better
Other cases
TODO: add more cases
Rust Version
$ rustc --version --verbose
rustc 1.86.0-nightly (48a426eca 2025-01-12)
binary: rustc
commit-hash: 48a426eca9df23b24b3559e545cf88dee61d4de9
commit-date: 2025-01-12
host: x86_64-unknown-linux-gnu
release: 1.86.0-nightly
LLVM version: 19.1.6
Anything else?
No response