rust/tests/ui/statics/static-methods-in-traits2.rs

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

23 lines
369 B
Rust
Raw Normal View History

//@ run-pass
//@ pretty-expanded FIXME #23616
pub trait Number: NumConv {
fn from<T:Number>(n: T) -> Self;
}
impl Number for f64 {
fn from<T:Number>(n: T) -> f64 { n.to_float() }
}
pub trait NumConv {
fn to_float(&self) -> f64;
}
impl NumConv for f64 {
fn to_float(&self) -> f64 { *self }
}
pub fn main() {
let _: f64 = Number::from(0.0f64);
}