Skip to content

Commit 113f38b

Browse files
committed
---
yaml --- r: 23613 b: refs/heads/master c: 7649860 h: refs/heads/master i: 23611: 2930ee6 v: v3
1 parent 17d7c97 commit 113f38b

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: afeaf7d88cda883428f0b18123f164e5d5a7e4f5
2+
refs/heads/master: 7649860339a0e298be75522d41d243b3bbb178b6
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

trunk/src/libcore/result.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -341,15 +341,10 @@ fn iter_vec2<S,T,U:copy>(ss: &[S], ts: &[T],
341341
}
342342

343343
/// Unwraps a result, assuming it is an `ok(T)`
344-
fn unwrap<T, U>(-res: Result<T, U>) -> T {
345-
unsafe {
346-
let addr = match res {
347-
Ok(x) => ptr::addr_of(x),
348-
Err(_) => fail ~"error result"
349-
};
350-
let liberated_value = unsafe::reinterpret_cast(*addr);
351-
unsafe::forget(res);
352-
return liberated_value;
344+
fn unwrap<T, U>(+res: Result<T, U>) -> T {
345+
match move res {
346+
Ok(move t) => t,
347+
Err(_) => fail ~"unwrap called on an err result"
353348
}
354349
}
355350

0 commit comments

Comments
 (0)