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-operator-on-main.rs:7:5
5 LL | | // error for a `Try` type on a non-`Try` fn
6 LL | | std::fs::File::open("foo")?;
7 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot use the `?` operator in a function that returns `()`
10 LL | | try_trait_generic::<()>();
12 | |_- this function should return `Result` or `Option` to accept `?`
14 = help: the trait `Try` is not implemented for `()`
15 = note: required by `from_error`
17 error[E0277]: the `?` operator can only be applied to values that implement `Try`
18 --> $DIR/try-operator-on-main.rs:10:5
21 | ^^^ the `?` operator cannot be applied to type `()`
23 = help: the trait `Try` is not implemented for `()`
24 = note: required by `into_result`
26 error[E0277]: the trait bound `(): Try` is not satisfied
27 --> $DIR/try-operator-on-main.rs:13:25
29 LL | try_trait_generic::<()>();
30 | ^^ the trait `Try` is not implemented for `()`
32 LL | fn try_trait_generic<T: Try>() -> T {
33 | --- required by this bound in `try_trait_generic`
35 error[E0277]: the `?` operator can only be applied to values that implement `Try`
36 --> $DIR/try-operator-on-main.rs:20:5
39 | ^^^ the `?` operator cannot be applied to type `()`
41 = help: the trait `Try` is not implemented for `()`
42 = note: required by `into_result`
44 error: aborting due to 4 previous errors
46 For more information about this error, try `rustc --explain E0277`.