]> git.proxmox.com Git - rustc.git/blame - src/doc/book/listings/ch09-error-handling/no-listing-06-question-mark-in-main/output.txt
New upstream version 1.56.0~beta.4+dfsg1
[rustc.git] / src / doc / book / listings / ch09-error-handling / no-listing-06-question-mark-in-main / output.txt
CommitLineData
74b04a01
XL
1$ cargo run
2 Compiling error-handling v0.1.0 (file:///projects/error-handling)
94222f64
XL
3error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
4 --> src/main.rs:4:36
74b04a01
XL
5 |
63 | / fn main() {
74 | | let f = File::open("hello.txt")?;
94222f64 8 | | ^ cannot use the `?` operator in a function that returns `()`
74b04a01
XL
95 | | }
10 | |_- this function should return `Result` or `Option` to accept `?`
11 |
94222f64
XL
12 = help: the trait `FromResidual<Result<Infallible, std::io::Error>>` is not implemented for `()`
13 = note: required by `from_residual`
74b04a01
XL
14
15error: aborting due to previous error
16
17For more information about this error, try `rustc --explain E0277`.
fc512014 18error: could not compile `error-handling`
74b04a01
XL
19
20To learn more, run the command again with --verbose.