about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-01-04 21:50:12 +0000
committerbors <bors@rust-lang.org>2020-01-04 21:50:12 +0000
commit7494250106003d698579edef215d0c01810b5156 (patch)
tree2162bd329ca39cb45c1ddc32393d459ee8caab68 /src/libsyntax
parent760ce94c69ca510d44087291c311296f6d9ccdf5 (diff)
parentcdf32e1a0f8fc207b177857775c29549f609a094 (diff)
downloadrust-7494250106003d698579edef215d0c01810b5156.tar.gz
rust-7494250106003d698579edef215d0c01810b5156.zip
Auto merge of #67803 - Centril:librustc_hir, r=Zoxc
Extract `rustc_hir` out of `rustc`

The new crate contains:
```rust
pub mod def;
pub mod def_id;
mod hir;
pub mod hir_id;
pub mod itemlikevisit;
pub mod pat_util;
pub mod print;
mod stable_hash_impls;

pub use hir::*;
pub use hir_id::*;
pub use stable_hash_impls::HashStableContext;
```

Remains to be done in follow-up PRs:

- Move `rustc::hir::map` into `rustc_hir_map` -- this has to be a separate crate due to the `dep_graph` (blocked on https://github.com/rust-lang/rust/pull/67761).

- Move references to `rustc::hir` to `rustc_hir` where possible.

cc https://github.com/rust-lang/rust/issues/65031

r? @Zoxc
Diffstat (limited to 'src/libsyntax')
-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)
+    }
+}