fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error[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 3 | 4LL | fn main() { 5 | --------- this function should return `Result` or `Option` to accept `?` 6LL | // error for a `Try` type on a non-`Try` fn 7LL | std::fs::File::open("foo")?; 8 | ^ cannot use the `?` operator in a function that returns `()` 9 | 10 = help: the trait `FromResidual<Result<Infallible, std::io::Error>>` is not implemented for `()` 11 12error[E0277]: the `?` operator can only be applied to values that implement `Try` 13 --> $DIR/try-operator-on-main.rs:10:5 14 | 15LL | ()?; 16 | ^^^ the `?` operator cannot be applied to type `()` 17 | 18 = help: the trait `Try` is not implemented for `()` 19 20error[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 22 | 23LL | fn main() { 24 | --------- this function should return `Result` or `Option` to accept `?` 25... 26LL | ()?; 27 | ^ cannot use the `?` operator in a function that returns `()` 28 | 29 = help: the trait `FromResidual<_>` is not implemented for `()` 30 31error[E0277]: the trait bound `(): Try` is not satisfied 32 --> $DIR/try-operator-on-main.rs:14:25 33 | 34LL | try_trait_generic::<()>(); 35 | ^^ the trait `Try` is not implemented for `()` 36 | 37note: required by a bound in `try_trait_generic` 38 --> $DIR/try-operator-on-main.rs:17:25 39 | 40LL | fn try_trait_generic<T: Try>() -> T { 41 | ^^^ required by this bound in `try_trait_generic` 42 43error[E0277]: the `?` operator can only be applied to values that implement `Try` 44 --> $DIR/try-operator-on-main.rs:19:5 45 | 46LL | ()?; 47 | ^^^ the `?` operator cannot be applied to type `()` 48 | 49 = help: the trait `Try` is not implemented for `()` 50 51error: aborting due to 5 previous errors 52 53For more information about this error, try `rustc --explain E0277`.