2024-02-16 20:02:50 +00:00
|
|
|
//@ run-pass
|
2019-07-26 21:54:25 +00:00
|
|
|
|
2018-08-18 21:24:25 +00:00
|
|
|
#![allow(unused_must_use)]
|
|
|
|
|
|
|
|
use std::convert::TryFrom;
|
|
|
|
use std::num::TryFromIntError;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let x: u32 = 125;
|
|
|
|
let y: Result<u8, TryFromIntError> = u8::try_from(x);
|
|
|
|
y == Ok(125);
|
|
|
|
}
|