//! 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;
}
}
+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
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
+ }
+}