+
+ pub fn def_key(self, id: DefId) -> hir_map::DefKey {
+ if id.is_local() {
+ self.hir.def_key(id)
+ } else {
+ self.cstore.def_key(id)
+ }
+ }
+
+ /// Convert a `DefId` into its fully expanded `DefPath` (every
+ /// `DefId` is really just an interned def-path).
+ ///
+ /// Note that if `id` is not local to this crate, the result will
+ /// be a non-local `DefPath`.
+ pub fn def_path(self, id: DefId) -> hir_map::DefPath {
+ if id.is_local() {
+ self.hir.def_path(id)
+ } else {
+ self.cstore.def_path(id)
+ }
+ }
+
+ #[inline]
+ pub fn def_path_hash(self, def_id: DefId) -> hir_map::DefPathHash {
+ if def_id.is_local() {
+ self.hir.definitions().def_path_hash(def_id.index)
+ } else {
+ self.cstore.def_path_hash(def_id)
+ }
+ }
+
+ pub fn metadata_encoding_version(self) -> Vec<u8> {
+ self.cstore.metadata_encoding_version().to_vec()
+ }
+
+ // Note that this is *untracked* and should only be used within the query
+ // system if the result is otherwise tracked through queries
+ pub fn crate_data_as_rc_any(self, cnum: CrateNum) -> Rc<Any> {
+ self.cstore.crate_data_as_rc_any(cnum)
+ }
+}
+
+impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
+ pub fn encode_metadata(self, link_meta: &LinkMeta, reachable: &NodeSet)
+ -> (EncodedMetadata, EncodedMetadataHashes)
+ {
+ self.cstore.encode_metadata(self, link_meta, reachable)
+ }