]> git.proxmox.com Git - rustc.git/blobdiff - src/librustc/ty/maps/keys.rs
New upstream version 1.26.0+dfsg1
[rustc.git] / src / librustc / ty / maps / keys.rs
index b7b64c9761a8e091eceb964b95fc16f88f0a23c1..b8167ec918638be880a6bc0351e98c105208dd01 100644 (file)
 //! Defines the set of legal keys that can be used in queries.
 
 use hir::def_id::{CrateNum, DefId, LOCAL_CRATE, DefIndex};
+use traits::query::{CanonicalProjectionGoal, CanonicalTyGoal};
 use ty::{self, Ty, TyCtxt};
 use ty::subst::Substs;
 use ty::fast_reject::SimplifiedType;
+use mir;
 
 use std::fmt::Debug;
 use std::hash::Hash;
@@ -52,6 +54,16 @@ impl<'tcx> Key for ty::Instance<'tcx> {
     }
 }
 
+impl<'tcx> Key for mir::interpret::GlobalId<'tcx> {
+    fn map_crate(&self) -> CrateNum {
+        self.instance.map_crate()
+    }
+
+    fn default_span(&self, tcx: TyCtxt) -> Span {
+        self.instance.default_span(tcx)
+    }
+}
+
 impl Key for CrateNum {
     fn map_crate(&self) -> CrateNum {
         *self
@@ -159,3 +171,23 @@ impl Key for InternedString {
         DUMMY_SP
     }
 }
+
+impl<'tcx> Key for CanonicalProjectionGoal<'tcx> {
+    fn map_crate(&self) -> CrateNum {
+        LOCAL_CRATE
+    }
+
+    fn default_span(&self, _tcx: TyCtxt) -> Span {
+        DUMMY_SP
+    }
+}
+
+impl<'tcx> Key for CanonicalTyGoal<'tcx> {
+    fn map_crate(&self) -> CrateNum {
+        LOCAL_CRATE
+    }
+
+    fn default_span(&self, _tcx: TyCtxt) -> Span {
+        DUMMY_SP
+    }
+}