/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
- // 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>), }
- fn nested(o: t) {
- match o {
- bar(i, some::<int>(_)) => { error!{"wrong pattern matched"}; fail; }
- _ => { error!{"succeeded"}; }
- }
- }
- fn main() { nested(bar(1, none::<int>)); }