Answer the question
In order to leave comments, you need to log in
Why doesn't try! with File::open?
I'm trying to compile an example:
use std::fs::File;
fn main() {
let f = try!(File::open("in.txt"));
}
<std macros>:5:8: 6:42 error: mismatched types:
expected `()`,
found `core::result::Result<_, _>`
(expected (),
found enum `core::result::Result`) [E0308]
<std macros>:5 return $ crate:: result:: Result:: Err (
<std macros>:6 $ crate:: convert:: From:: from ( err ) ) } } )
<std macros>:1:1: 6:48 note: in expansion of try!
sum.rs:4:13: 4:39 note: expansion site
error: aborting due to previous error
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question