about summary refs log tree commit diff
path: root/src/libsyntax/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax/lib.rs')
-rw-r--r--src/libsyntax/lib.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs
index 0b0a19517ec..72beddf7bb5 100644
--- a/src/libsyntax/lib.rs
+++ b/src/libsyntax/lib.rs
@@ -102,7 +102,17 @@ pub mod print {
 
 pub mod early_buffered_lints;
 
+use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
+
 /// Requirements for a `StableHashingContext` to be used in this crate.
 /// This is a hack to allow using the `HashStable_Generic` derive macro
 /// instead of implementing everything in librustc.
-pub trait HashStableContext: rustc_span::HashStableContext {}
+pub trait HashStableContext: rustc_span::HashStableContext {
+    fn hash_attr(&mut self, _: &ast::Attribute, hasher: &mut StableHasher);
+}
+
+impl<AstCtx: crate::HashStableContext> HashStable<AstCtx> for ast::Attribute {
+    fn hash_stable(&self, hcx: &mut AstCtx, hasher: &mut StableHasher) {
+        hcx.hash_attr(self, hasher)
+    }
+}