summary refs log tree commit diff
path: root/src/test/run-pass/static-methods-in-traits2.rs
blob: 20e6efa11f0903aa9ab190dffee2e4b903c2717d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
pub trait Number: NumConv {
    fn from<T:Number>(n: T) -> Self;
}

impl Number for float {
    fn from<T:Number>(n: T) -> float { n.to_float() }
}

pub trait NumConv {
    fn to_float(&self) -> float;
}

impl NumConv for float {
    fn to_float(&self) -> float { *self }
}

pub fn main() {
    let _: float = Number::from(0.0f);
}