/src/test/compile-fail/pattern-tyvar-2.rs

http://github.com/jruderman/rust · Rust · 13 lines · 6 code · 5 blank · 2 comment · 1 complexity · 5b1076cd14622d31eedc6f67adba3c30 MD5 · raw file

  1. // -*- rust -*-
  2. use std;
  3. import option;
  4. import option::some;
  5. // error-pattern: mismatched types
  6. enum bar { t1((), option<~[int]>), t2, }
  7. fn foo(t: bar) -> int { match t { t1(_, some(x)) => { return x * 3; } _ => { fail; } } }
  8. fn main() { }