1 error[E0277]: `?` couldn't convert the error to `()`
2 --> $DIR/try-on-option.rs:7:6
4 LL | fn foo() -> Result<u32, ()> {
5 | --------------- expected `()` because of this
6 LL | let x: Option<u32> = None;
8 | ^ the trait `From<NoneError>` is not implemented for `()`
10 = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
11 = note: required by `from`
12 help: consider converting the `Option<T>` into a `Result<T, _>` using `Option::ok_or` or `Option::ok_or_else`
14 LL | x.ok_or_else(|| /* error value */)?;
15 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17 error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `Try`)
18 --> $DIR/try-on-option.rs:13:5
20 LL | / fn bar() -> u32 {
21 LL | | let x: Option<u32> = None;
23 | | ^^ cannot use the `?` operator in a function that returns `u32`
26 | |_- this function should return `Result` or `Option` to accept `?`
28 = help: the trait `Try` is not implemented for `u32`
29 = note: required by `from_error`
31 error: aborting due to 2 previous errors
33 For more information about this error, try `rustc --explain E0277`.