Closed
Description
If I write this code:
#[cfg(FALSE)]
extern const fn hello() {}
error: expected `fn`, found keyword `const`
--> src/lib.rs:2:8
| ...
= note: keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern`
That's a great message, very helpful... except the order is wrong. If I write:
#[cfg(FALSE)]
default pub const async unsafe extern fn hello() {}
The compiler gives me a weird error message.
The correct order is pub
, default
, const
, async
, unsafe
, extern
; in other words, pub
before everything else.
Indeed, the following code compiles without complaint:
#[cfg(FALSE)]
pub default const async unsafe extern fn hello() {}
(as well as other variants with pub(crate)
, crate
, etc)
The diagnostic suggestion should be fixed.