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-operator-on-main.rs:7:31
5 | --------- this function should return `Result` or `Option` to accept `?`
6 LL | // error for a `Try` type on a non-`Try` fn
7 LL | std::fs::File::open("foo")?;
8 | ^ cannot use the `?` operator in a function that returns `()`
10 = help: the trait `FromResidual<Result<Infallible, std::io::Error>>` is not implemented for `()`
12 error[E0277]: the `?` operator can only be applied to values that implement `Try`
13 --> $DIR/try-operator-on-main.rs:10:5
16 | ^^^ the `?` operator cannot be applied to type `()`
18 = help: the trait `Try` is not implemented for `()`
20 error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
21 --> $DIR/try-operator-on-main.rs:10:7
24 | --------- this function should return `Result` or `Option` to accept `?`
27 | ^ cannot use the `?` operator in a function that returns `()`
29 = help: the trait `FromResidual<_>` is not implemented for `()`
31 error[E0277]: the trait bound `(): Try` is not satisfied
32 --> $DIR/try-operator-on-main.rs:14:25
34 LL | try_trait_generic::<()>();
35 | ^^ the trait `Try` is not implemented for `()`
37 note: required by a bound in `try_trait_generic`
38 --> $DIR/try-operator-on-main.rs:17:25
40 LL | fn try_trait_generic<T: Try>() -> T {
41 | ^^^ required by this bound in `try_trait_generic`
43 error[E0277]: the `?` operator can only be applied to values that implement `Try`
44 --> $DIR/try-operator-on-main.rs:19:5
47 | ^^^ the `?` operator cannot be applied to type `()`
49 = help: the trait `Try` is not implemented for `()`
51 error: aborting due to 5 previous errors
53 For more information about this error, try `rustc --explain E0277`.