Skip to content

Commit be15585

Browse files
committed
---
yaml --- r: 21375 b: refs/heads/snap-stage3 c: 6cf2f89 h: refs/heads/master i: 21373: d703f0e 21371: f8f231c 21367: 2aaa941 21359: 0e5f52c 21343: f581fc6 21311: d4ff223 21247: d1970c8 v: v3
1 parent d36bcb7 commit be15585

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: e430a699f2c60890d9b86069fd0c68a70ece7120
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: bed37a1dc915cbc8e7333ee6822b03b096347356
4+
refs/heads/snap-stage3: 6cf2f89452675d231956324333180810273625b0
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libcore/option.rs

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,14 @@ pure fn get_ref<T>(opt: &r/option<T>) -> &r/T {
4444
}
4545

4646
pure fn expect<T: copy>(opt: option<T>, reason: ~str) -> T {
47-
#[doc = "
48-
Gets the value out of an option, printing a specified message on failure
49-
50-
# Failure
51-
52-
Fails if the value equals `none`
53-
"];
47+
/*!
48+
* Gets the value out of an option, printing a specified message on
49+
* failure
50+
*
51+
* # Failure
52+
*
53+
* Fails if the value equals `none`
54+
*/
5455
match opt { some(x) => x, none => fail reason }
5556
}
5657

@@ -165,15 +166,9 @@ pure fn unwrap<T>(+opt: option<T>) -> T {
165166
* Useful primarily for getting strings, vectors and unique pointers out
166167
* of option types without copying them.
167168
*/
168-
169-
unsafe {
170-
let addr = match opt {
171-
some(x) => ptr::addr_of(x),
172-
none => fail ~"option::unwrap none"
173-
};
174-
let liberated_value = unsafe::reinterpret_cast(*addr);
175-
unsafe::forget(opt);
176-
return liberated_value;
169+
match move opt {
170+
some(move x) => x,
171+
none => fail ~"option::unwrap none"
177172
}
178173
}
179174

0 commit comments

Comments
 (0)