]> git.lizzy.rs Git - rust.git/blob - src/test/ui/statics/static-methods-in-traits2.rs
Rollup merge of #104849 - GuillaumeGomez:source-code-sidebar-css-migration, r=notriddle
[rust.git] / src / test / ui / statics / static-methods-in-traits2.rs
1 // run-pass
2 // pretty-expanded FIXME #23616
3
4 pub trait Number: NumConv {
5     fn from<T:Number>(n: T) -> Self;
6 }
7
8 impl Number for f64 {
9     fn from<T:Number>(n: T) -> f64 { n.to_float() }
10 }
11
12 pub trait NumConv {
13     fn to_float(&self) -> f64;
14 }
15
16 impl NumConv for f64 {
17     fn to_float(&self) -> f64 { *self }
18 }
19
20 pub fn main() {
21     let _: f64 = Number::from(0.0f64);
22 }