about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2020-02-15 18:07:17 +0100
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2020-02-15 18:07:17 +0100
commit8a37811e2c3b89beb135cf96dcb5d887a6262751 (patch)
tree5dcd6f76c1cd21236ccfff282cda052584318942
parenta7db5051d14994474c641328333884aeba70ca25 (diff)
downloadrust-8a37811e2c3b89beb135cf96dcb5d887a6262751.tar.gz
rust-8a37811e2c3b89beb135cf96dcb5d887a6262751.zip
Panic when hashing node IDs
-rw-r--r--src/librustc/ich/hcx.rs9
-rw-r--r--src/libsyntax/node_id.rs2
2 files changed, 3 insertions, 8 deletions
diff --git a/src/librustc/ich/hcx.rs b/src/librustc/ich/hcx.rs
index e0e8470fe47..9e2db35dc6d 100644
--- a/src/librustc/ich/hcx.rs
+++ b/src/librustc/ich/hcx.rs
@@ -219,12 +219,9 @@ impl<'a> ToStableHashKey<StableHashingContext<'a>> for hir::HirId {
     }
 }
 
-impl<'a> ToStableHashKey<StableHashingContext<'a>> for ast::NodeId {
-    type KeyType = Self;
-
-    #[inline]
-    fn to_stable_hash_key(&self, _: &StableHashingContext<'a>) -> Self {
-        *self
+impl<'a> HashStable<StableHashingContext<'a>> for ast::NodeId {
+    fn hash_stable(&self, _: &mut StableHashingContext<'a>, _: &mut StableHasher) {
+        panic!("Node IDs should not appear in incremental state");
     }
 }
 
diff --git a/src/libsyntax/node_id.rs b/src/libsyntax/node_id.rs
index 430d8f30421..58d2334a7b1 100644
--- a/src/libsyntax/node_id.rs
+++ b/src/libsyntax/node_id.rs
@@ -1,10 +1,8 @@
-use rustc_macros::HashStable_Generic;
 use rustc_serialize::{Decoder, Encoder};
 use rustc_span::ExpnId;
 use std::fmt;
 
 rustc_index::newtype_index! {
-    #[derive(HashStable_Generic)]
     pub struct NodeId {
         ENCODABLE = custom
         DEBUG_FORMAT = "NodeId({})"