1 error[E0277]: the `?` operator can only be used on `Result`s, not `Option`s, in a function that returns `Result`
2 --> $DIR/try-on-option.rs:5:6
4 LL | / fn foo() -> Result<u32, ()> {
5 LL | | let x: Option<u32> = None;
7 | | ^ use `.ok_or(...)?` to provide an error compatible with `Result<u32, ()>`
10 | |_- this function returns a `Result`
12 = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `Result<u32, ()>`
14 error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
15 --> $DIR/try-on-option.rs:11:6
17 LL | / fn bar() -> u32 {
18 LL | | let x: Option<u32> = None;
20 | | ^ cannot use the `?` operator in a function that returns `u32`
23 | |_- this function should return `Result` or `Option` to accept `?`
25 = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `u32`
27 error: aborting due to 2 previous errors
29 For more information about this error, try `rustc --explain E0277`.