Revert "Revert "Make option::get return the option contents by reference" due to memory corruption"

This reverts commit d1c27ba9e06e08e1dc27b493144e467d0efd526c.
This commit is contained in:
Patrick Walton 2011-09-16 12:20:06 -07:00
parent 679c2d25a1
commit d9c664e3fa

View File

@ -2,8 +2,8 @@
tag t<@T> { none; some(T); }
fn get<@T>(opt: t<T>) -> T {
alt opt { some(x) { x } none. { fail "option none" } }
fn get<@T>(opt: t<T>) -> &T {
alt opt { some(x) { ret x; } none. { fail "option none"; } }
}
fn map<@T, @U>(f: block(T) -> U, opt: t<T>) -> t<U> {