You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#![feature(try_from, never_type)]
use std::convert::TryFrom;
use std::num::TryFromIntError;
fn main() {
let x: u8 = 125;
let y: Result<u32, !> = u32::try_from(x);
let _ = y == Ok(125); // OK
let x: u32 = 125;
let y: Result<u8, TryFromIntError> = u8::try_from(x);
let _ = y.ok() == Some(125); // OK
let x: u32 = 125;
let y: Result<u8, TryFromIntError> = u8::try_from(x);
let _ = y == Ok(125); // Error
}
I think I'd like the std library to add #[derive(PartialEq)] to std::num::TryFromIntError, so the last line compiles.
The text was updated successfully, but these errors were encountered:
Regarding code like this:
I think I'd like the std library to add #[derive(PartialEq)] to std::num::TryFromIntError, so the last line compiles.
The text was updated successfully, but these errors were encountered: