1 error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `std::ops::Try`)
2 --> $DIR/try-operator-on-main.rs:19:5
4 LL | std::fs::File::open("foo")?; //~ ERROR the `?` operator can only
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot use the `?` operator in a function that returns `()`
7 = help: the trait `std::ops::Try` is not implemented for `()`
8 = note: required by `std::ops::Try::from_error`
10 error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
11 --> $DIR/try-operator-on-main.rs:22:5
13 LL | ()?; //~ ERROR the `?` operator can only
14 | ^^^ the `?` operator cannot be applied to type `()`
16 = help: the trait `std::ops::Try` is not implemented for `()`
17 = note: required by `std::ops::Try::into_result`
19 error[E0277]: the trait bound `(): std::ops::Try` is not satisfied
20 --> $DIR/try-operator-on-main.rs:25:5
22 LL | try_trait_generic::<()>(); //~ ERROR the trait bound
23 | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::ops::Try` is not implemented for `()`
25 note: required by `try_trait_generic`
26 --> $DIR/try-operator-on-main.rs:30:1
28 LL | fn try_trait_generic<T: Try>() -> T {
29 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
31 error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
32 --> $DIR/try-operator-on-main.rs:32:5
34 LL | ()?; //~ ERROR the `?` operator can only
35 | ^^^ the `?` operator cannot be applied to type `()`
37 = help: the trait `std::ops::Try` is not implemented for `()`
38 = note: required by `std::ops::Try::into_result`
40 error: aborting due to 4 previous errors
42 For more information about this error, try `rustc --explain E0277`.