]> git.lizzy.rs Git - rust.git/blob - src/test/ui/parser/recover-const-async-fn-ptr.rs
Change syntax for TyAlias where clauses
[rust.git] / src / test / ui / parser / recover-const-async-fn-ptr.rs
1 // edition:2018
2
3 type T0 = const fn(); //~ ERROR an `fn` pointer type cannot be `const`
4 type T1 = const extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `const`
5 type T2 = const unsafe extern fn(); //~ ERROR an `fn` pointer type cannot be `const`
6 type T3 = async fn(); //~ ERROR an `fn` pointer type cannot be `async`
7 type T4 = async extern fn(); //~ ERROR an `fn` pointer type cannot be `async`
8 type T5 = async unsafe extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `async`
9 type T6 = const async unsafe extern "C" fn();
10 //~^ ERROR an `fn` pointer type cannot be `const`
11 //~| ERROR an `fn` pointer type cannot be `async`
12
13 type FT0 = for<'a> const fn(); //~ ERROR an `fn` pointer type cannot be `const`
14 type FT1 = for<'a> const extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `const`
15 type FT2 = for<'a> const unsafe extern fn(); //~ ERROR an `fn` pointer type cannot be `const`
16 type FT3 = for<'a> async fn(); //~ ERROR an `fn` pointer type cannot be `async`
17 type FT4 = for<'a> async extern fn(); //~ ERROR an `fn` pointer type cannot be `async`
18 type FT5 = for<'a> async unsafe extern "C" fn(); //~ ERROR an `fn` pointer type cannot be `async`
19 type FT6 = for<'a> const async unsafe extern "C" fn();
20 //~^ ERROR an `fn` pointer type cannot be `const`
21 //~| ERROR an `fn` pointer type cannot be `async`
22
23 fn main() {
24     let _recovery_witness: () = 0; //~ ERROR mismatched types
25 }