blob: dca24d0be8a2acb458ea7771beaccd1b25269f3e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
// run-pass
#[derive(Debug)]
struct Matrix4<S>(#[allow(unused_tuple_struct_fields)] S);
trait POrd<S> {}
fn translate<S: POrd<S>>(s: S) -> Matrix4<S> { Matrix4(s) }
impl POrd<f32> for f32 {}
impl POrd<f64> for f64 {}
fn main() {
let x = 1.0;
let m : Matrix4<f32> = translate(x);
println!("m: {:?}", m);
}
|