rust/src/test/run-pass/expr-alt-generic-unique2.rs

19 lines
412 B
Rust
Raw Normal View History

// xfail-fast
// -*- rust -*-
#[legacy_modes];
type compare<T> = fn@(T, T) -> bool;
fn test_generic<T: Copy>(expected: T, eq: compare<T>) {
2012-08-23 16:44:58 -05:00
let actual: T = match true { true => expected, _ => fail ~"wat" };
assert (eq(expected, actual));
}
fn test_vec() {
2012-08-01 19:30:05 -05:00
fn compare_box(&&v1: ~int, &&v2: ~int) -> bool { return v1 == v2; }
2012-06-19 21:34:01 -05:00
test_generic::<~int>(~1, compare_box);
}
fn main() { test_vec(); }