Closed
Description
I tried this code:
match "+".parse::<f32>() {
Ok(v) => println!("f32 OK: {}", v),
Err(e) => println!("f32 Error: {}", e)
}
match "-".parse::<f64>() {
Ok(v) => println!("f64 OK: {}", v),
Err(e) => println!("f64 Error: {}", e)
}
I expected to see this happen: "Error: invalid float literal"
Instead, this happened: OK: 0
It seems the "leading +" and "leading -" is broken.
Further, with i32 and i64 is emits an error but IMO an incorrect one:
"cannot parse integer from empty string"
I would expect: "Invalid integer literal"
Meta
rustc --version --verbose
:
rustc 1.5.0-nightly (81b3b27 2015-10-11)
binary: rustc
commit-hash: 81b3b27
commit-date: 2015-10-11
host: x86_64-unknown-linux-gnu
release: 1.5.0-nightly