Revert "Revert "Make option::get return the option contents by reference" due to memory corruption"
This reverts commit d1c27ba9e06e08e1dc27b493144e467d0efd526c.
This commit is contained in:
parent
679c2d25a1
commit
d9c664e3fa
@ -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> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user