1
Fork 0
rust/tests/ui/traits/inheritance/num0.rs

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

23 lines
430 B
Rust
Raw Normal View History

//@ run-pass
#![allow(dead_code)]
// Extending Num and using inherited static methods
//@ pretty-expanded FIXME #23616
pub trait NumCast: Sized {
2015-04-17 22:12:20 -07:00
fn from(i: i32) -> Option<Self>;
}
pub trait Num {
fn from_int(i: isize) -> Self;
fn gt(&self, other: &Self) -> bool;
}
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.gt(&NumCast::from(1).unwrap())
}
pub fn main() {}