about summary refs log tree commit diff
path: root/src/comp
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2010-12-09 14:03:43 -0800
committerPatrick Walton <pcwalton@mimiga.net>2010-12-09 14:03:43 -0800
commit5a6cc341adba6f94cb54eecab76df8461ffa9de7 (patch)
treec6d7e12b11a10dc2cff8eb84ee30aa5f8fa5e65d /src/comp
parente5bbe93646708ef13377840dd225022cf3077d2a (diff)
downloadrust-5a6cc341adba6f94cb54eecab76df8461ffa9de7.tar.gz
rust-5a6cc341adba6f94cb54eecab76df8461ffa9de7.zip
rustc: Add gross eq_ty() and hash_ty() functions
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/middle/typeck.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs
index 2ca20977145..fc09bd92f6b 100644
--- a/src/comp/middle/typeck.rs
+++ b/src/comp/middle/typeck.rs
@@ -639,6 +639,17 @@ fn plain_ty(&sty st) -> @ty {
     ret @rec(struct=st, mut=ast.imm, cname=none[str]);
 }
 
+fn hash_ty(&@ty t) -> uint {
+    ret _str.hash(ty_to_str(t));
+}
+
+fn eq_ty(&@ty a, &@ty b) -> bool {
+    // FIXME: this is gross, but I think it's safe, and I don't think writing
+    // a giant function to handle all the cases is necessary when structural
+    // equality will someday save the day.
+    ret _str.eq(ty_to_str(a), ty_to_str(b));
+}
+
 fn ann_to_type(&ast.ann ann) -> @ty {
     alt (ann) {
         case (ast.ann_none) {