Created
May 2, 2012 19:02
-
-
Save nikomatsakis/2579281 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn unwrap<T, U>(-res: result<T, U>) -> T unsafe { | |
let addr = alt res { | |
ok(x) { ptr::addr_of(x) } | |
err(_) { fail "option none" } | |
}; | |
let liberated_value = unsafe::reinterpret_cast(*addr); | |
unsafe::forget(res); | |
ret liberated_value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment