diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2019-11-23 14:47:31 +0100 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2019-11-23 18:52:23 +0100 |
| commit | 782cc9f65c0c19ef79bd009074e09bf0394674f4 (patch) | |
| tree | c367a73f0bcc04651ec1fb77f6ba9655d4a94353 /src/librustc/ich | |
| parent | 4d1674f62007053ddeba44e27459e18128cc97cf (diff) | |
| download | rust-782cc9f65c0c19ef79bd009074e09bf0394674f4.tar.gz rust-782cc9f65c0c19ef79bd009074e09bf0394674f4.zip | |
Derive HashStable for TokenKind.
Diffstat (limited to 'src/librustc/ich')
| -rw-r--r-- | src/librustc/ich/impls_syntax.rs | 67 |
1 files changed, 1 insertions, 66 deletions
diff --git a/src/librustc/ich/impls_syntax.rs b/src/librustc/ich/impls_syntax.rs index 2d7db94bf8c..144980c53eb 100644 --- a/src/librustc/ich/impls_syntax.rs +++ b/src/librustc/ich/impls_syntax.rs @@ -3,12 +3,8 @@ use crate::ich::StableHashingContext; -use std::hash as std_hash; -use std::mem; - use syntax::ast; use syntax::feature_gate; -use syntax::token; use syntax_pos::SourceFile; use crate::hir::def_id::{DefId, CrateNum, CRATE_DEF_INDEX}; @@ -65,68 +61,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for ast::Attribute { } } -impl<'ctx> syntax::HashStableContext for StableHashingContext<'ctx> { - fn hash_stable_tokenkind(&mut self, tokenkind: &token::TokenKind, hasher: &mut StableHasher) { - mem::discriminant(tokenkind).hash_stable(self, hasher); - match *tokenkind { - token::Eq | - token::Lt | - token::Le | - token::EqEq | - token::Ne | - token::Ge | - token::Gt | - token::AndAnd | - token::OrOr | - token::Not | - token::Tilde | - token::At | - token::Dot | - token::DotDot | - token::DotDotDot | - token::DotDotEq | - token::Comma | - token::Semi | - token::Colon | - token::ModSep | - token::RArrow | - token::LArrow | - token::FatArrow | - token::Pound | - token::Dollar | - token::Question | - token::SingleQuote | - token::Whitespace | - token::Comment | - token::Eof => {} - - token::BinOp(bin_op_token) | - token::BinOpEq(bin_op_token) => { - std_hash::Hash::hash(&bin_op_token, hasher); - } - - token::OpenDelim(delim_token) | - token::CloseDelim(delim_token) => { - std_hash::Hash::hash(&delim_token, hasher); - } - token::Literal(lit) => lit.hash_stable(self, hasher), - - token::Ident(name, is_raw) => { - name.hash_stable(self, hasher); - is_raw.hash_stable(self, hasher); - } - token::Lifetime(name) => name.hash_stable(self, hasher), - - token::Interpolated(_) => { - bug!("interpolated tokens should not be present in the HIR") - } - - token::DocComment(val) | - token::Shebang(val) | - token::Unknown(val) => val.hash_stable(self, hasher), - } - } -} +impl<'ctx> syntax::HashStableContext for StableHashingContext<'ctx> {} impl<'a> HashStable<StableHashingContext<'a>> for SourceFile { fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) { |
