Strange mismatched type between core and std on beta


#1

Hello,
I have just started to convert one project from Rust Nightly to Rust Beta-3, and I’m blocking with this:

use std::num::ParseFloatError;
use std::str::FromStr;

#[derive(Debug)]
pub enum ParseError {
    InvalidValue(ParseFloatError),
} 

fn test() -> Result<f32, ParseError>{

    let value = match f32::from_str("1.0") {
        Ok(v) => v,
        Err(e) => return Err(ParseError::InvalidValue(e)),
    };

    Ok(value)
}

fn main() {
    test();
}
$ rustc test.rs
test.rs:13:55: 13:56 error: mismatched types:
 expected `std::num::ParseFloatError`,
    found `core::num::ParseFloatError`
(expected struct `std::num::ParseFloatError`,
    found struct `core::num::ParseFloatError`) [E0308]
test.rs:13         Err(e) => return Err(ParseError::InvalidValue(e)),
                                                                 ^
error: aborting due to previous error

It is a rust bug? Or something wrong with my code?


#2

You may be hitting this issue, which came to light in this StackOverflow question.