about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/comp/middle/ty.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs
index 5829c0bed2d..59de7768612 100644
--- a/src/comp/middle/ty.rs
+++ b/src/comp/middle/ty.rs
@@ -2484,17 +2484,17 @@ fn lookup_item_type(session.session sess,
     if (did._0 == sess.get_targ_crate_num()) {
         // The item is in this crate. The caller should have added it to the
         // type cache already; we simply return it.
-        check (cache.contains_key(did));
         ret cache.get(did);
     }
 
-    if (cache.contains_key(did)) {
-        ret cache.get(did);
+    alt (cache.find(did)) {
+        case (some[ty_param_count_and_ty](?tpt)) { ret tpt; }
+        case (none[ty_param_count_and_ty]) {
+            auto tyt = creader.get_type(sess, tystore, did);
+            cache.insert(did, tyt);
+            ret tyt;
+        }
     }
-
-    auto tyt = creader.get_type(sess, tystore, did);
-    cache.insert(did, tyt);
-    ret tyt;
 }