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

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

15 lines
248 B
Rust
Raw Normal View History

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