]> git.lizzy.rs Git - rust.git/blob - tests/ui/async-await/try-on-option-in-async.rs
Rollup merge of #106960 - estebank:parse-anon-enums, r=cjgillot
[rust.git] / tests / ui / async-await / try-on-option-in-async.rs
1 #![feature(async_closure)]
2 // edition:2018
3 fn main() {}
4
5 async fn an_async_block() -> u32 {
6     async {
7         let x: Option<u32> = None;
8         x?; //~ ERROR the `?` operator
9         22
10     }
11     .await
12 }
13
14 async fn async_closure_containing_fn() -> u32 {
15     let async_closure = async || {
16         let x: Option<u32> = None;
17         x?; //~ ERROR the `?` operator
18         22_u32
19     };
20
21     async_closure().await
22 }
23
24 async fn an_async_function() -> u32 {
25     let x: Option<u32> = None;
26     x?; //~ ERROR the `?` operator
27     22
28 }