about summary refs log tree commit diff
path: root/src/libsyntax/ast.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax/ast.rs')
-rw-r--r--src/libsyntax/ast.rs44
1 files changed, 36 insertions, 8 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 0a9e0aedd3d..630f7768885 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -1075,15 +1075,29 @@ pub struct Typedef {
     pub typ: P<Ty>,
 }
 
-#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
+#[derive(Clone, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
 pub enum IntTy {
-    TyIs,
+    TyIs(bool /* is this deprecated `int`? */),
     TyI8,
     TyI16,
     TyI32,
     TyI64,
 }
 
+impl PartialEq for IntTy {
+    fn eq(&self, other: &IntTy) -> bool {
+        match (*self, *other) {
+            // true/false need to compare the same, so this can't be derived
+            (TyIs(_), TyIs(_)) |
+            (TyI8, TyI8) |
+            (TyI16, TyI16) |
+            (TyI32, TyI32) |
+            (TyI64, TyI64) => true,
+            _ => false
+        }
+    }
+}
+
 impl fmt::Show for IntTy {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         fmt::String::fmt(self, f)
@@ -1099,27 +1113,41 @@ impl fmt::String for IntTy {
 impl IntTy {
     pub fn suffix_len(&self) -> uint {
         match *self {
-            TyIs => 1,
-            TyI8 => 2,
+            TyIs(true) /* i */ => 1,
+            TyIs(false) /* is */ | TyI8 => 2,
             TyI16 | TyI32 | TyI64  => 3,
         }
     }
 }
 
-#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
+#[derive(Clone, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
 pub enum UintTy {
-    TyUs,
+    TyUs(bool /* is this deprecated uint? */),
     TyU8,
     TyU16,
     TyU32,
     TyU64,
 }
 
+impl PartialEq for UintTy {
+    fn eq(&self, other: &UintTy) -> bool {
+        match (*self, *other) {
+            // true/false need to compare the same, so this can't be derived
+            (TyUs(_), TyUs(_)) |
+            (TyU8, TyU8) |
+            (TyU16, TyU16) |
+            (TyU32, TyU32) |
+            (TyU64, TyU64) => true,
+            _ => false
+        }
+    }
+}
+
 impl UintTy {
     pub fn suffix_len(&self) -> uint {
         match *self {
-            TyUs => 1,
-            TyU8 => 2,
+            TyUs(true) /* u */ => 1,
+            TyUs(false) /* us */ | TyU8 => 2,
             TyU16 | TyU32 | TyU64  => 3,
         }
     }