Skip to content

Instantly share code, notes, and snippets.

@cr1901
Last active March 17, 2016 16:31
Show Gist options
  • Save cr1901/3d1a160a43ca7ce134cf to your computer and use it in GitHub Desktop.
Save cr1901/3d1a160a43ca7ce134cf to your computer and use it in GitHub Desktop.
I got nothing...
// TODO: Why doesn't try! work?
let mut fp = match File::open(obj) {
io::Result::File(x) => { x },
io::Result::Error(x) => { panic!("Error opening {}: {}", obj, x) }
};
/* src\main.rs:62:17: 62:36 error: no associated item named `File` found for type `core::result::Result<_, std::io::error::Error>` in the current scope
src\main.rs:62 io::Result::File(x) => { x },
^~~~~~~~~~~~~~~~~~~
src\main.rs:63:17: 63:37 error: no associated item named `Error` found for type `core::result::Result<_, std::io::error::Error>` in the current scope
src\main.rs:63 io::Result::Error(x) => { panic!("Error opening {}: {}", obj, x) }
^~~~~~~~~~~~~~~~~~~~ */
<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 ) ) } } )
src\main.rs:61:26: 61:47 note: in this expansion of try! (defined in <std macros>)
<std macros>:5:8: 6:42 help: run `rustc --explain E0308` to see a detailed explanation
src\main.rs:67:42: 67:45 error: mismatched types:
expected `&mut std::fs::File`,
found `&std::fs::File`
(values differ in mutability) [E0308]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment