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