]> git.lizzy.rs Git - rust.git/blob - src/test/ui/parser/issues/issue-87217-keyword-order/wrong-const.rs
Fix invalid keyword order for function declarations
[rust.git] / src / test / ui / parser / issues / issue-87217-keyword-order / wrong-const.rs
1 // edition:2018
2
3 // There is an order to respect for keywords before a function:
4 // `<visibility>, const, async, unsafe, extern, "<ABI>"`
5 //
6 // This test ensures the compiler is helpful about them being misplaced.
7 // Visibilities are tested elsewhere.
8
9 unsafe const fn test() {}
10 //~^ ERROR expected one of `extern` or `fn`, found keyword `const`
11 //~| NOTE expected one of `extern` or `fn`
12 //~| HELP `const` must come before `unsafe`
13 //~| SUGGESTION const unsafe
14 //~| NOTE keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`