core: doc/err feedback tweeks for result::unwrap
This commit is contained in:
parent
a40f550ed5
commit
bb88f772a4
@ -218,13 +218,11 @@ fn iter2<S,T,U:copy>(ss: [S], ts: [T],
|
|||||||
|
|
||||||
#[doc="
|
#[doc="
|
||||||
Unwraps a result, assuming it is an `ok(T)`
|
Unwraps a result, assuming it is an `ok(T)`
|
||||||
|
|
||||||
This operation is unsafe.
|
|
||||||
"]
|
"]
|
||||||
fn unwrap<T, U>(-res: result<T, U>) -> T unsafe {
|
fn unwrap<T, U>(-res: result<T, U>) -> T unsafe {
|
||||||
let addr = alt res {
|
let addr = alt res {
|
||||||
ok(x) { ptr::addr_of(x) }
|
ok(x) { ptr::addr_of(x) }
|
||||||
err(_) { fail "option none" }
|
err(_) { fail "error result" }
|
||||||
};
|
};
|
||||||
let liberated_value = unsafe::reinterpret_cast(*addr);
|
let liberated_value = unsafe::reinterpret_cast(*addr);
|
||||||
unsafe::forget(res);
|
unsafe::forget(res);
|
||||||
|
Loading…
Reference in New Issue
Block a user