mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
15 lines
304 B
Rust
15 lines
304 B
Rust
//@ run-pass
|
|
#[derive(Debug)]
|
|
struct Matrix4<S>(#[allow(dead_code)] 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);
|
|
}
|