/src/test/run-pass/nested-pattern.rs

http://github.com/jruderman/rust · Rust · 18 lines · 12 code · 5 blank · 1 comment · 1 complexity · 2cea4a4b545a4a291b8a5e8336b60f9e MD5 · raw file

  1. // a bug was causing this to complain about leaked memory on exit
  2. use std;
  3. import option;
  4. import option::some;
  5. import option::none;
  6. enum t { foo(int, uint), bar(int, option<int>), }
  7. fn nested(o: t) {
  8. match o {
  9. bar(i, some::<int>(_)) => { error!{"wrong pattern matched"}; fail; }
  10. _ => { error!{"succeeded"}; }
  11. }
  12. }
  13. fn main() { nested(bar(1, none::<int>)); }