rust/src/test/run-pass/generic-tup.rs

10 lines
206 B
Rust
Raw Normal View History

2011-08-15 06:39:45 -05:00
fn get_third[T](t: &(T, T, T)) -> T {
let (_, _, x) = t;
ret x;
}
fn main() {
log get_third((1, 2, 3));
assert (get_third((1, 2, 3)) == 3);
assert (get_third((5u8, 6u8, 7u8)) == 7u8);
}