]> git.lizzy.rs Git - rust.git/blob - src/test/ui/async-await/try-on-option-in-async.stderr
remove [async output] from impl Future
[rust.git] / src / test / ui / async-await / try-on-option-in-async.stderr
1 error[E0277]: the `?` operator can only be used in an async block that returns `Result` or `Option` (or another type that implements `FromResidual`)
2   --> $DIR/try-on-option-in-async.rs:8:10
3    |
4 LL |       async {
5    |  ___________-
6 LL | |         let x: Option<u32> = None;
7 LL | |         x?;
8    | |          ^ cannot use the `?` operator in an async block that returns `{integer}`
9 LL | |         22
10 LL | |     }
11    | |_____- this function should return `Result` or `Option` to accept `?`
12    |
13    = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `{integer}`
14
15 error[E0277]: the `?` operator can only be used in an async closure that returns `Result` or `Option` (or another type that implements `FromResidual`)
16   --> $DIR/try-on-option-in-async.rs:17:10
17    |
18 LL |       let async_closure = async || {
19    |  __________________________________-
20 LL | |         let x: Option<u32> = None;
21 LL | |         x?;
22    | |          ^ cannot use the `?` operator in an async closure that returns `u32`
23 LL | |         22_u32
24 LL | |     };
25    | |_____- this function should return `Result` or `Option` to accept `?`
26    |
27    = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `u32`
28
29 error[E0277]: the `?` operator can only be used in an async function that returns `Result` or `Option` (or another type that implements `FromResidual`)
30   --> $DIR/try-on-option-in-async.rs:26:6
31    |
32 LL |   async fn an_async_function() -> u32 {
33    |  _____________________________________-
34 LL | |     let x: Option<u32> = None;
35 LL | |     x?;
36    | |      ^ cannot use the `?` operator in an async function that returns `u32`
37 LL | |     22
38 LL | | }
39    | |_- this function should return `Result` or `Option` to accept `?`
40    |
41    = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `u32`
42
43 error: aborting due to 3 previous errors
44
45 For more information about this error, try `rustc --explain E0277`.