]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/middle/stability.rs
Auto merge of #44350 - GuillaumeGomez:id-false-positive, r=QuietMisdreavus
[rust.git] / src / librustc / middle / stability.rs
index 1cf96a4c56db587a35402c5740553d04ce14af56..89049958309a126a61a033afde7f6b71587e7d9e 100644 (file)
@@ -65,6 +65,11 @@ pub struct DeprecationEntry {
     origin: Option<HirId>,
 }
 
+impl_stable_hash_for!(struct self::DeprecationEntry {
+    attr,
+    origin
+});
+
 impl DeprecationEntry {
     fn local(attr: Deprecation, id: HirId) -> DeprecationEntry {
         DeprecationEntry {
@@ -102,6 +107,13 @@ pub struct Index<'tcx> {
     active_features: FxHashSet<Symbol>,
 }
 
+impl_stable_hash_for!(struct self::Index<'tcx> {
+    stab_map,
+    depr_map,
+    staged_api,
+    active_features
+});
+
 // A private tree-walker for producing an Index.
 struct Annotator<'a, 'tcx: 'a> {
     tcx: TyCtxt<'a, 'tcx, 'tcx>,
@@ -427,6 +439,7 @@ pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Index<'tcx> {
                     },
                     feature: Symbol::intern("rustc_private"),
                     rustc_depr: None,
+                    rustc_const_unstable: None,
                 });
                 annotator.parent_stab = Some(stability);
             }
@@ -612,8 +625,8 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
                 // compiler-generated `extern crate` items have a dummy span.
                 if item.span == DUMMY_SP { return }
 
-                let hir_id = self.tcx.hir.node_to_hir_id(item.id);
-                let cnum = match self.tcx.extern_mod_stmt_cnum(hir_id) {
+                let def_id = self.tcx.hir.local_def_id(item.id);
+                let cnum = match self.tcx.extern_mod_stmt_cnum(def_id) {
                     Some(cnum) => cnum,
                     None => return,
                 };