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

8 lines
198 B
Rust
Raw Normal View History

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