/src/test/run-pass/nested-pattern.rs
Rust | 18 lines | 12 code | 5 blank | 1 comment | 0 complexity | 2cea4a4b545a4a291b8a5e8336b60f9e MD5 | raw file
1 2 3// a bug was causing this to complain about leaked memory on exit 4use std; 5import option; 6import option::some; 7import option::none; 8 9enum t { foo(int, uint), bar(int, option<int>), } 10 11fn nested(o: t) { 12 match o { 13 bar(i, some::<int>(_)) => { error!{"wrong pattern matched"}; fail; } 14 _ => { error!{"succeeded"}; } 15 } 16} 17 18fn main() { nested(bar(1, none::<int>)); }