rust/tests/ui/traits/inheritance/num1.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

16 lines
281 B
Rust
Raw Normal View History

//@ run-pass
#![allow(dead_code)]
//@ pretty-expanded FIXME #23616
pub trait NumCast: Sized {
2015-04-18 05:12:20 +00:00
fn from(i: i32) -> Option<Self>;
}
2014-11-10 00:30:52 +00:00
pub trait NumExt: NumCast + PartialOrd { }
fn greater_than_one<T:NumExt>(n: &T) -> bool {
2015-01-25 21:05:03 +00:00
*n > NumCast::from(1).unwrap()
}
pub fn main() {}