diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2012-08-27 16:26:35 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2012-08-29 18:25:22 -0700 |
| commit | 96534365c228d9c3962036967a7f1a1b17639e33 (patch) | |
| tree | 2be1b50575fcf57f7627418950731d3b17de7b89 /src/libsyntax/ext | |
| parent | 94720fcea762338be3edfb29cbc8292e761f5585 (diff) | |
| download | rust-96534365c228d9c3962036967a7f1a1b17639e33.tar.gz rust-96534365c228d9c3962036967a7f1a1b17639e33.zip | |
rustc: Make `<` and `=` into traits
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/pipes/proto.rs | 13 | ||||
| -rw-r--r-- | src/libsyntax/ext/simplext.rs | 7 |
2 files changed, 17 insertions, 3 deletions
diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs index ab810bd48fd..3d763c27140 100644 --- a/src/libsyntax/ext/pipes/proto.rs +++ b/src/libsyntax/ext/pipes/proto.rs @@ -3,8 +3,17 @@ import dvec::DVec; import ast_builder::{path, append_types}; -enum direction { - send, recv +enum direction { send, recv } + +impl direction : cmp::Eq { + pure fn eq(&&other: direction) -> bool { + match (self, other) { + (send, send) => true, + (recv, recv) => true, + (send, _) => false, + (recv, _) => false, + } + } } impl direction: ToStr { diff --git a/src/libsyntax/ext/simplext.rs b/src/libsyntax/ext/simplext.rs index 3097c70478a..d9a09ffde83 100644 --- a/src/libsyntax/ext/simplext.rs +++ b/src/libsyntax/ext/simplext.rs @@ -466,7 +466,12 @@ fn p_t_s_rec(cx: ext_ctxt, m: matchable, s: selector, b: binders) { match_result { return match m { match_expr(e) => { - if e == pat { Some(leaf(match_exact)) } else { None } + if box::ptr_eq(e, pat) { + // XXX: Is this right? + Some(leaf(match_exact)) + } else { + None + } } _ => cx.bug(~"broken traversal in p_t_s_r") } |
