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 | ---------------------- this function should return `Result` or `Option` to accept `?`
6 LL | let x: Option<u32> = None;
8 | ^ cannot use the `?` operator in a function that returns `u32`
10 = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `u32`
12 error[E0277]: the `?` operator can only be used in a closure that returns `Result` or `Option` (or another type that implements `FromResidual`)
13 --> $DIR/try-on-option-diagnostics.rs:14:10
15 LL | let a_closure = || {
16 | -- this function should return `Result` or `Option` to accept `?`
17 LL | let x: Option<u32> = None;
19 | ^ cannot use the `?` operator in a closure that returns `{integer}`
21 = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `{integer}`
23 error[E0277]: the `?` operator can only be used in a method that returns `Result` or `Option` (or another type that implements `FromResidual`)
24 --> $DIR/try-on-option-diagnostics.rs:26:14
27 | ------------- this function should return `Result` or `Option` to accept `?`
28 LL | let x: Option<u32> = None;
30 | ^ cannot use the `?` operator in a method that returns `()`
32 = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `()`
34 error[E0277]: the `?` operator can only be used in a trait method that returns `Result` or `Option` (or another type that implements `FromResidual`)
35 --> $DIR/try-on-option-diagnostics.rs:39:14
37 LL | fn a_trait_method() {
38 | ------------------- this function should return `Result` or `Option` to accept `?`
39 LL | let x: Option<u32> = None;
41 | ^ cannot use the `?` operator in a trait method that returns `()`
43 = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `()`
45 error: aborting due to 4 previous errors
47 For more information about this error, try `rustc --explain E0277`.