1 error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
2 --> $DIR/try-on-option-diagnostics.rs:7:6
4 LL | / fn a_function() -> u32 {
5 LL | | let x: Option<u32> = None;
7 | | ^ cannot use the `?` operator in a function that returns `u32`
10 | |_- this function should return `Result` or `Option` to accept `?`
12 = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `u32`
14 error[E0277]: the `?` operator can only be used in a closure that returns `Result` or `Option` (or another type that implements `FromResidual`)
15 --> $DIR/try-on-option-diagnostics.rs:14:10
17 LL | let a_closure = || {
18 | _____________________-
19 LL | | let x: Option<u32> = None;
21 | | ^ cannot use the `?` operator in a closure that returns `{integer}`
24 | |_____- this function should return `Result` or `Option` to accept `?`
26 = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `{integer}`
28 error[E0277]: the `?` operator can only be used in a method that returns `Result` or `Option` (or another type that implements `FromResidual`)
29 --> $DIR/try-on-option-diagnostics.rs:26:14
31 LL | / fn a_method() {
32 LL | | let x: Option<u32> = None;
34 | | ^ cannot use the `?` operator in a method that returns `()`
36 | |_________- this function should return `Result` or `Option` to accept `?`
38 = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `()`
40 error[E0277]: the `?` operator can only be used in a trait method that returns `Result` or `Option` (or another type that implements `FromResidual`)
41 --> $DIR/try-on-option-diagnostics.rs:39:14
43 LL | / fn a_trait_method() {
44 LL | | let x: Option<u32> = None;
46 | | ^ cannot use the `?` operator in a trait method that returns `()`
48 | |_________- this function should return `Result` or `Option` to accept `?`
50 = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `()`
52 error: aborting due to 4 previous errors
54 For more information about this error, try `rustc --explain E0277`.