aboutsummaryrefslogtreecommitdiff
path: root/src/test/run-pass/expr-alt-generic-box1.rs
blob: a1367e81b8cf7b0084b6e12cd092ba1bd5cd2b40 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// xfail-boot
// -*- rust -*-

type compare[T] = fn(@T t1, @T t2) -> bool;

fn test_generic[T](@T expected, &compare[T] eq) {
  let @T actual = alt (true) {
    case (true) {
      expected
    }
  };
  assert (eq(expected, actual));
}

fn test_box() {
  fn compare_box(@bool b1, @bool b2) -> bool {
    ret *b1 == *b2;
  }
  auto eq = bind compare_box(_, _);
  test_generic[bool](@true, eq);
}

fn main() {
  test_box();
}