rust/src/test/auxiliary/issue2378a.rs
2012-08-06 15:36:30 -07:00

10 lines
191 B
Rust

enum maybe<T> { just(T), nothing }
impl methods<T:copy> for maybe<T> {
fn ~[](idx: uint) -> T {
match self {
just(t) { t }
nothing { fail; }
}
}
}