1 error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `Try`)
2 --> $DIR/try-on-option-diagnostics.rs:7:5
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 `Try` is not implemented for `u32`
13 = note: required by `from_error`
15 error[E0277]: the `?` operator can only be used in a closure that returns `Result` or `Option` (or another type that implements `Try`)
16 --> $DIR/try-on-option-diagnostics.rs:14:9
18 LL | let a_closure = || {
19 | _____________________-
20 LL | | let x: Option<u32> = None;
22 | | ^^ cannot use the `?` operator in a closure that returns `{integer}`
25 | |_____- this function should return `Result` or `Option` to accept `?`
27 = help: the trait `Try` is not implemented for `{integer}`
28 = note: required by `from_error`
30 error[E0277]: the `?` operator can only be used in a method that returns `Result` or `Option` (or another type that implements `Try`)
31 --> $DIR/try-on-option-diagnostics.rs:26:13
33 LL | / fn a_method() {
34 LL | | let x: Option<u32> = None;
36 | | ^^ cannot use the `?` operator in a method that returns `()`
38 | |_________- this function should return `Result` or `Option` to accept `?`
40 = help: the trait `Try` is not implemented for `()`
41 = note: required by `from_error`
43 error[E0277]: the `?` operator can only be used in a trait method that returns `Result` or `Option` (or another type that implements `Try`)
44 --> $DIR/try-on-option-diagnostics.rs:39:13
46 LL | / fn a_trait_method() {
47 LL | | let x: Option<u32> = None;
49 | | ^^ cannot use the `?` operator in a trait method that returns `()`
51 | |_________- this function should return `Result` or `Option` to accept `?`
53 = help: the trait `Try` is not implemented for `()`
54 = note: required by `from_error`
56 error: aborting due to 4 previous errors
58 For more information about this error, try `rustc --explain E0277`.