2018-03-28 11:25:52 +02:00
|
|
|
error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `std::ops::Try`)
|
2018-01-02 17:19:20 +01:00
|
|
|
--> $DIR/try-operator-on-main.rs:19:5
|
2017-08-31 00:12:34 +03:00
|
|
|
|
|
2018-02-23 03:42:32 +03:00
|
|
|
LL | std::fs::File::open("foo")?; //~ ERROR the `?` operator can only
|
2018-01-26 11:34:12 -08:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot use the `?` operator in a function that returns `()`
|
2017-06-30 17:11:12 -07:00
|
|
|
|
|
2017-08-31 13:06:13 +03:00
|
|
|
= help: the trait `std::ops::Try` is not implemented for `()`
|
2017-06-30 17:11:12 -07:00
|
|
|
= note: required by `std::ops::Try::from_error`
|
|
|
|
|
2017-08-31 22:52:49 +03:00
|
|
|
error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
|
2018-01-02 17:19:20 +01:00
|
|
|
--> $DIR/try-operator-on-main.rs:22:5
|
2017-08-31 00:12:34 +03:00
|
|
|
|
|
2018-02-23 03:42:32 +03:00
|
|
|
LL | ()?; //~ ERROR the `?` operator can only
|
2018-01-26 11:34:12 -08:00
|
|
|
| ^^^ the `?` operator cannot be applied to type `()`
|
2017-08-31 21:46:03 +03:00
|
|
|
|
|
2017-08-31 22:52:49 +03:00
|
|
|
= help: the trait `std::ops::Try` is not implemented for `()`
|
2017-08-31 21:46:03 +03:00
|
|
|
= note: required by `std::ops::Try::into_result`
|
|
|
|
|
|
|
|
error[E0277]: the trait bound `(): std::ops::Try` is not satisfied
|
2018-01-02 17:19:20 +01:00
|
|
|
--> $DIR/try-operator-on-main.rs:25:5
|
2017-08-31 21:46:03 +03:00
|
|
|
|
|
2018-02-23 03:42:32 +03:00
|
|
|
LL | try_trait_generic::<()>(); //~ ERROR the trait bound
|
2017-08-31 00:12:34 +03:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::ops::Try` is not implemented for `()`
|
|
|
|
|
|
2018-01-15 14:26:36 -08:00
|
|
|
note: required by `try_trait_generic`
|
|
|
|
--> $DIR/try-operator-on-main.rs:30:1
|
|
|
|
|
|
2018-02-23 03:42:32 +03:00
|
|
|
LL | fn try_trait_generic<T: Try>() -> T {
|
2018-01-15 14:26:36 -08:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2017-08-31 00:12:34 +03:00
|
|
|
|
2017-08-31 22:52:49 +03:00
|
|
|
error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
|
2018-01-02 17:19:20 +01:00
|
|
|
--> $DIR/try-operator-on-main.rs:32:5
|
2017-08-31 21:46:03 +03:00
|
|
|
|
|
2018-02-23 03:42:32 +03:00
|
|
|
LL | ()?; //~ ERROR the `?` operator can only
|
2018-01-26 11:34:12 -08:00
|
|
|
| ^^^ the `?` operator cannot be applied to type `()`
|
2017-08-31 21:46:03 +03:00
|
|
|
|
|
2017-08-31 22:52:49 +03:00
|
|
|
= help: the trait `std::ops::Try` is not implemented for `()`
|
2017-08-31 21:46:03 +03:00
|
|
|
= note: required by `std::ops::Try::into_result`
|
|
|
|
|
|
|
|
error: aborting due to 4 previous errors
|
2017-06-30 17:11:12 -07:00
|
|
|
|
2018-03-03 15:59:40 +01:00
|
|
|
For more information about this error, try `rustc --explain E0277`.
|