mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-01 03:03:40 +00:00
23 lines
367 B
Rust
23 lines
367 B
Rust
// 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);
|
|
}
|