about summary refs log tree commit diff
path: root/src/test/run-pass/trait-inheritance-num0.rs
blob: 6c3b22894f56a9adbe58cb27e14aa81092c2e127 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Extending Num and using inherited static methods

use num::from_int;

trait Num {
    static fn from_int(i: int) -> self;
    fn gt(&self, other: &self) -> bool;
}

pub trait NumExt: Num { }

fn greater_than_one<T:NumExt>(n: &T) -> bool {
    n.gt(&from_int(1))
}

fn main() {}