Skip to content

Commit 8a37811

Browse files
committed
Panic when hashing node IDs
1 parent a7db505 commit 8a37811

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

src/librustc/ich/hcx.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,9 @@ impl<'a> ToStableHashKey<StableHashingContext<'a>> for hir::HirId {
219219
}
220220
}
221221

222-
impl<'a> ToStableHashKey<StableHashingContext<'a>> for ast::NodeId {
223-
type KeyType = Self;
224-
225-
#[inline]
226-
fn to_stable_hash_key(&self, _: &StableHashingContext<'a>) -> Self {
227-
*self
222+
impl<'a> HashStable<StableHashingContext<'a>> for ast::NodeId {
223+
fn hash_stable(&self, _: &mut StableHashingContext<'a>, _: &mut StableHasher) {
224+
panic!("Node IDs should not appear in incremental state");
228225
}
229226
}
230227

src/libsyntax/node_id.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
use rustc_macros::HashStable_Generic;
21
use rustc_serialize::{Decoder, Encoder};
32
use rustc_span::ExpnId;
43
use std::fmt;
54

65
rustc_index::newtype_index! {
7-
#[derive(HashStable_Generic)]
86
pub struct NodeId {
97
ENCODABLE = custom
108
DEBUG_FORMAT = "NodeId({})"

0 commit comments

Comments
 (0)