Skip to content

Commit 89ac36f

Browse files
committed
---
yaml --- r: 28121 b: refs/heads/try c: 5792244 h: refs/heads/master i: 28119: 6bc696c v: v3
1 parent 6c29abb commit 89ac36f

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
5-
refs/heads/try: 161a82e433fbfbc0bd57a4d951ac37656a8a30f6
5+
refs/heads/try: 5792244d03149fafdf65fc1bbc05b24323fbfa1a
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df

branches/try/src/libcore/option.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
* type.
99
*/
1010

11+
use cmp::Eq;
12+
1113
/// The option type
1214
enum Option<T> {
1315
None,
@@ -247,6 +249,25 @@ impl<T: copy> Option<T> {
247249
pure fn while_some(blk: fn(+T) -> Option<T>) { while_some(self, blk) }
248250
}
249251

252+
impl<T: Eq> Option<T> : Eq {
253+
pure fn eq(&&other: Option<T>) -> bool {
254+
match self {
255+
None => {
256+
match other {
257+
None => true,
258+
Some(_) => false
259+
}
260+
}
261+
Some(self_contents) => {
262+
match other {
263+
None => false,
264+
Some(other_contents) => self_contents.eq(other_contents)
265+
}
266+
}
267+
}
268+
}
269+
}
270+
250271
#[test]
251272
fn test_unwrap_ptr() {
252273
let x = ~0;

0 commit comments

Comments
 (0)