diff options
| author | Michael Woerister <michaelwoerister@posteo> | 2018-02-14 16:11:02 +0100 |
|---|---|---|
| committer | Michael Woerister <michaelwoerister@posteo> | 2018-03-05 11:05:01 +0100 |
| commit | 542bc75deaaf4e84dcd7a196685bc1a1cb100d32 (patch) | |
| tree | af895d8de41f2569ac3235ab8b244e2853dfe54c /src/librustc/ich | |
| parent | e2746d870017c869b84fc56ecd63f5e4f9646c96 (diff) | |
| download | rust-542bc75deaaf4e84dcd7a196685bc1a1cb100d32.tar.gz rust-542bc75deaaf4e84dcd7a196685bc1a1cb100d32.zip | |
Turn features() into a query.
Diffstat (limited to 'src/librustc/ich')
| -rw-r--r-- | src/librustc/ich/impls_syntax.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/librustc/ich/impls_syntax.rs b/src/librustc/ich/impls_syntax.rs index c31a5c9d86d..f935cbfcde9 100644 --- a/src/librustc/ich/impls_syntax.rs +++ b/src/librustc/ich/impls_syntax.rs @@ -17,6 +17,7 @@ use std::hash as std_hash; use std::mem; use syntax::ast; +use syntax::feature_gate; use syntax::parse::token; use syntax::symbol::InternedString; use syntax::tokenstream; @@ -460,3 +461,21 @@ fn stable_non_narrow_char(swc: ::syntax_pos::NonNarrowChar, (pos.0 - filemap_start.0, width as u32) } + + + +impl<'gcx> HashStable<StableHashingContext<'gcx>> for feature_gate::Features { + fn hash_stable<W: StableHasherResult>(&self, + hcx: &mut StableHashingContext<'gcx>, + hasher: &mut StableHasher<W>) { + // Unfortunately we cannot exhaustively list fields here, since the + // struct is macro generated. + self.declared_stable_lang_features.hash_stable(hcx, hasher); + self.declared_lib_features.hash_stable(hcx, hasher); + + self.walk_feature_fields(|feature_name, value| { + feature_name.hash_stable(hcx, hasher); + value.hash_stable(hcx, hasher); + }); + } +} |
