fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.9 KiB44 linesraw
1error[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   |
4LL | /     async {
5LL | |         let x: Option<u32> = None;
6LL | |         x?;
7   | |          ^ cannot use the `?` operator in an async block that returns `{integer}`
8LL | |         22
9LL | |     }
10   | |_____- this function should return `Result` or `Option` to accept `?`
11   |
12   = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `{integer}`
13
14error[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   |
17LL |       let async_closure = async || {
18   |  __________________________________-
19LL | |         let x: Option<u32> = None;
20LL | |         x?;
21   | |          ^ cannot use the `?` operator in an async closure that returns `u32`
22LL | |         22_u32
23LL | |     };
24   | |_____- this function should return `Result` or `Option` to accept `?`
25   |
26   = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `u32`
27
28error[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   |
31LL |   async fn an_async_function() -> u32 {
32   |  _____________________________________-
33LL | |     let x: Option<u32> = None;
34LL | |     x?;
35   | |      ^ cannot use the `?` operator in an async function that returns `u32`
36LL | |     22
37LL | | }
38   | |_- this function should return `Result` or `Option` to accept `?`
39   |
40   = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `u32`
41
42error: aborting due to 3 previous errors
43
44For more information about this error, try `rustc --explain E0277`.