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

19 lines
381 B
Rust
Raw Normal View History

// a bug was causing this to complain about leaked memory on exit
use std;
import option;
import option::some;
import option::none;
enum t { foo(int, uint), bar(int, option<int>), }
2011-07-27 07:19:39 -05:00
fn nested(o: t) {
2012-08-06 14:34:08 -05:00
match o {
2012-08-03 21:59:04 -05:00
bar(i, some::<int>(_)) => { error!{"wrong pattern matched"}; fail; }
_ => { error!{"succeeded"}; }
}
}
fn main() { nested(bar(1, none::<int>)); }