Closed
Description
I have code that match
es on a Result<usize>
, with cases for Ok(usize_var)
and Err(why)
. I get a "match arms have incompatible types" error upon compilation which I believe is incorrect.
I'm not incredibly experienced with this, but discussion in irc (https://botbot.me/mozilla/rust/2015-04-06/?msg=35985521&page=37) supports that this may be a bug.
I tried this code (available at http://is.gd/Y00aRi):
fn main() {
let mut input: String = String::new();
match std::io::stdin().read_line(&mut input) {
Ok(bytes_read) => bytes_read,
Err(why) => panic!("{}", why)
}
println!("{}", input);
}
I expected it to compile, however there is a "match arms have incompatible types" error even though I believe the match arms should both be of type usize.
I should note that adding a semicolon after the match causes clean compilation.