Skip to content

Commit ded95d2

Browse files
committed
deriving_eq for tokens and binops
Note that the replaced definition of equality on tokens contains a *huge* shortcut on INTERPOLATED tokens (those that contain ASTs), whereby any two INTERPOLATED tokens are considered equal. This seems like a really broken notion of equality, but it appears that the existing test cases and the compiler don't depend on it. Niko noticed this, BTW. Replace long definition of Eq on tokens and binops w
1 parent 16da4e1 commit ded95d2

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/libsyntax/parse/token.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use std::oldmap::HashMap;
2525

2626
#[auto_encode]
2727
#[auto_decode]
28+
#[deriving_eq]
2829
pub enum binop {
2930
PLUS,
3031
MINUS,
@@ -518,12 +519,6 @@ pub fn reserved_keyword_table() -> HashMap<~str, ()> {
518519
words
519520
}
520521

521-
impl binop : cmp::Eq {
522-
pure fn eq(&self, other: &binop) -> bool {
523-
((*self) as uint) == ((*other) as uint)
524-
}
525-
pure fn ne(&self, other: &binop) -> bool { !(*self).eq(other) }
526-
}
527522

528523
impl Token : cmp::Eq {
529524
pure fn eq(&self, other: &Token) -> bool {

0 commit comments

Comments
 (0)