rust/src/test/run-pass/nested-pattern.rs
Tim Chevalier e5d095d67e Change option::t to option
Now that core exports "option" as a synonym for option::t, search-and-
replace option::t with option.

The only place that still refers to option::t are the modules in libcore
that use option, because fixing this requires a new snapshot
(forthcoming).
2012-01-31 17:05:20 -08:00

19 lines
373 B
Rust

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