mirror of https://github.com/rust-lang-ru/book.git
11 changed files with 2061 additions and 33 deletions
@ -1,16 +1,15 @@
@@ -1,16 +1,15 @@
|
||||
$ cargo run |
||||
Compiling error-handling v0.1.0 (file:///projects/error-handling) |
||||
error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) |
||||
--> src/main.rs:4:36 |
||||
| |
||||
3 | / fn main() { |
||||
4 | | let f = File::open("hello.txt")?; |
||||
| | ^ cannot use the `?` operator in a function that returns `()` |
||||
5 | | } |
||||
| |_- this function should return `Result` or `Option` to accept `?` |
||||
| |
||||
= help: the trait `FromResidual<Result<Infallible, std::io::Error>>` is not implemented for `()` |
||||
note: required by `from_residual` |
||||
--> src/main.rs:4:36 |
||||
| |
||||
3 | / fn main() { |
||||
4 | | let f = File::open("hello.txt")?; |
||||
| | ^ cannot use the `?` operator in a function that returns `()` |
||||
5 | | } |
||||
| |_- this function should return `Result` or `Option` to accept `?` |
||||
| |
||||
= help: the trait `FromResidual<Result<Infallible, std::io::Error>>` is not implemented for `()` |
||||
|
||||
For more information about this error, try `rustc --explain E0277`. |
||||
error: could not compile `error-handling` due to previous error |
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue