1 // Ensures that all `fn` forms can have all the function qualifiers syntactically.
5 #![feature(const_extern_fn)]
8 async fn ff1() {} // OK.
9 unsafe fn ff2() {} // OK.
10 const fn ff3() {} // OK.
11 extern "C" fn ff4() {} // OK.
12 const async unsafe extern "C" fn ff5() {} // OK.
13 //~^ ERROR functions cannot be both `const` and `async`
16 async fn ft1(); //~ ERROR functions in traits cannot be declared `async`
17 unsafe fn ft2(); // OK.
18 const fn ft3(); //~ ERROR functions in traits cannot be declared const
19 extern "C" fn ft4(); // OK.
20 const async unsafe extern "C" fn ft5();
21 //~^ ERROR functions in traits cannot be declared `async`
22 //~| ERROR functions in traits cannot be declared const
23 //~| ERROR functions cannot be both `const` and `async`
28 async fn ft1() {} //~ ERROR functions in traits cannot be declared `async`
29 //~^ ERROR method `ft1` has an incompatible type for trait
30 unsafe fn ft2() {} // OK.
31 const fn ft3() {} //~ ERROR functions in traits cannot be declared const
32 extern "C" fn ft4() {}
33 const async unsafe extern "C" fn ft5() {}
34 //~^ ERROR functions in traits cannot be declared `async`
35 //~| ERROR functions in traits cannot be declared const
36 //~| ERROR method `ft5` has an incompatible type for trait
37 //~| ERROR functions cannot be both `const` and `async`
41 async fn fi1() {} // OK.
42 unsafe fn fi2() {} // OK.
43 const fn fi3() {} // OK.
44 extern "C" fn fi4() {} // OK.
45 const async unsafe extern "C" fn fi5() {}
46 //~^ ERROR functions cannot be both `const` and `async`
50 async fn fe1(); //~ ERROR functions in `extern` blocks cannot have qualifiers
51 unsafe fn fe2(); //~ ERROR functions in `extern` blocks cannot have qualifiers
52 const fn fe3(); //~ ERROR functions in `extern` blocks cannot have qualifiers
53 extern "C" fn fe4(); //~ ERROR functions in `extern` blocks cannot have qualifiers
54 const async unsafe extern "C" fn fe5(); //~ ERROR functions in `extern` blocks
55 //~^ ERROR functions cannot be both `const` and `async`