File tree Expand file tree Collapse file tree 2 files changed +12
-17
lines changed
branches/dist-snap/src/libcore Expand file tree Collapse file tree 2 files changed +12
-17
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
8
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9
9
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10
- refs/heads/dist-snap: bed37a1dc915cbc8e7333ee6822b03b096347356
10
+ refs/heads/dist-snap: 6cf2f89452675d231956324333180810273625b0
11
11
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
12
12
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
Original file line number Diff line number Diff line change @@ -44,13 +44,14 @@ pure fn get_ref<T>(opt: &r/option<T>) -> &r/T {
44
44
}
45
45
46
46
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
+ */
54
55
match opt { some( x) => x, none => fail reason }
55
56
}
56
57
@@ -165,15 +166,9 @@ pure fn unwrap<T>(+opt: option<T>) -> T {
165
166
* Useful primarily for getting strings, vectors and unique pointers out
166
167
* of option types without copying them.
167
168
*/
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"
177
172
}
178
173
}
179
174
You can’t perform that action at this time.
0 commit comments