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

http://github.com/jruderman/rust · Rust · 19 lines · 13 code · 4 blank · 2 comment · 1 complexity · 34fd992c283e65eb82c3cf465fe84788 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) {
  8. match t {
  9. t1(_, some::<int>(x)) => {
  10. log(debug, x);
  11. }
  12. _ => { fail; }
  13. }
  14. }
  15. fn main() { }