summaryrefslogtreecommitdiffstats
path: root/src/test/ui/parser/issues/issue-87217-keyword-order/wrong-const.rs
blob: 2f5fbc513ee3658051aa788acfd35edd47e520ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// edition:2018

// There is an order to respect for keywords before a function:
// `<visibility>, const, async, unsafe, extern, "<ABI>"`
//
// This test ensures the compiler is helpful about them being misplaced.
// Visibilities are tested elsewhere.

unsafe const fn test() {}
//~^ ERROR expected one of `extern` or `fn`, found keyword `const`
//~| NOTE expected one of `extern` or `fn`
//~| HELP `const` must come before `unsafe`
//~| SUGGESTION const unsafe
//~| NOTE keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`