]>
Commit | Line | Data |
---|---|---|
ea8adc8c | 1 | error[E0277]: the `?` operator can only be used in a function that returns `Result` (or another type that implements `std::ops::Try`) |
2c00a5a8 | 2 | --> $DIR/try-operator-on-main.rs:19:5 |
041b39d2 | 3 | | |
2c00a5a8 XL |
4 | 19 | std::fs::File::open("foo")?; //~ ERROR the `?` operator can only |
5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot use the `?` operator in a function that returns `()` | |
041b39d2 XL |
6 | | |
7 | = help: the trait `std::ops::Try` is not implemented for `()` | |
8 | = note: required by `std::ops::Try::from_error` | |
9 | ||
ea8adc8c | 10 | error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try` |
2c00a5a8 | 11 | --> $DIR/try-operator-on-main.rs:22:5 |
ea8adc8c | 12 | | |
2c00a5a8 XL |
13 | 22 | ()?; //~ ERROR the `?` operator can only |
14 | | ^^^ the `?` operator cannot be applied to type `()` | |
ea8adc8c XL |
15 | | |
16 | = help: the trait `std::ops::Try` is not implemented for `()` | |
17 | = note: required by `std::ops::Try::into_result` | |
18 | ||
19 | error[E0277]: the trait bound `(): std::ops::Try` is not satisfied | |
2c00a5a8 | 20 | --> $DIR/try-operator-on-main.rs:25:5 |
ea8adc8c | 21 | | |
2c00a5a8 | 22 | 25 | try_trait_generic::<()>(); //~ ERROR the trait bound |
ea8adc8c XL |
23 | | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::ops::Try` is not implemented for `()` |
24 | | | |
2c00a5a8 XL |
25 | note: required by `try_trait_generic` |
26 | --> $DIR/try-operator-on-main.rs:30:1 | |
27 | | | |
28 | 30 | fn try_trait_generic<T: Try>() -> T { | |
29 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
ea8adc8c XL |
30 | |
31 | error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try` | |
2c00a5a8 | 32 | --> $DIR/try-operator-on-main.rs:32:5 |
ea8adc8c | 33 | | |
2c00a5a8 XL |
34 | 32 | ()?; //~ ERROR the `?` operator can only |
35 | | ^^^ the `?` operator cannot be applied to type `()` | |
ea8adc8c XL |
36 | | |
37 | = help: the trait `std::ops::Try` is not implemented for `()` | |
38 | = note: required by `std::ops::Try::into_result` | |
39 | ||
40 | error: aborting due to 4 previous errors | |
041b39d2 | 41 |