]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/ich/hcx.rs
Move librustc_hir/def_id.rs to librustc_span/def_id.rs
[rust.git] / src / librustc / ich / hcx.rs
index 86cad00af17a8d547c9f12b7187e9db248560987..76e4b5f01b775cd4c099ccac8f6c7e6c938e9bd2 100644 (file)
@@ -1,5 +1,3 @@
-use crate::hir;
-use crate::hir::def_id::{DefId, DefIndex};
 use crate::hir::map::definitions::Definitions;
 use crate::hir::map::DefPathHash;
 use crate::ich::{self, CachingSourceMapView};
@@ -7,17 +5,18 @@
 use crate::session::Session;
 use crate::ty::{fast_reject, TyCtxt};
 
-use std::cmp::Ord;
-
+use rustc_data_structures::fx::{FxHashMap, FxHashSet};
+use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey};
+use rustc_data_structures::sync::Lrc;
+use rustc_hir as hir;
+use rustc_hir::def_id::{DefId, DefIndex};
 use rustc_span::source_map::SourceMap;
 use rustc_span::symbol::Symbol;
 use rustc_span::{BytePos, SourceFile};
 use syntax::ast;
 
-use rustc_data_structures::fx::{FxHashMap, FxHashSet};
-use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey};
-use rustc_data_structures::sync::Lrc;
 use smallvec::SmallVec;
+use std::cmp::Ord;
 
 fn compute_ignored_attr_names() -> FxHashSet<Symbol> {
     debug_assert!(ich::IGNORED_ATTRIBUTES.len() > 0);
@@ -250,6 +249,12 @@ fn hash_spans(&self) -> bool {
         self.hash_spans
     }
 
+    #[inline]
+    fn hash_def_id(&mut self, def_id: DefId, hasher: &mut StableHasher) {
+        let hcx = self;
+        hcx.def_path_hash(def_id).hash_stable(hcx, hasher);
+    }
+
     fn byte_pos_to_line_and_col(
         &mut self,
         byte: BytePos,