HashStable literals in libsyntax.

This commit is contained in:
Camille GILLOT 2019-11-09 22:02:24 +01:00
parent efcb695f4c
commit 2a67986eb6
2 changed files with 2 additions and 21 deletions

View file

@ -137,25 +137,6 @@ for tokenstream::TokenStream {
}
}
impl_stable_hash_for!(enum token::LitKind {
Bool,
Byte,
Char,
Integer,
Float,
Str,
ByteStr,
StrRaw(n),
ByteStrRaw(n),
Err
});
impl_stable_hash_for!(struct token::Lit {
kind,
symbol,
suffix
});
impl<'a> HashStable<StableHashingContext<'a>> for token::TokenKind {
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
mem::discriminant(self).hash_stable(hcx, hasher);

View file

@ -53,7 +53,7 @@ impl DelimToken {
}
}
#[derive(Clone, Copy, PartialEq, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Copy, PartialEq, RustcEncodable, RustcDecodable, Debug, HashStable_Generic)]
pub enum LitKind {
Bool, // AST only, must never appear in a `Token`
Byte,
@ -68,7 +68,7 @@ pub enum LitKind {
}
/// A literal token.
#[derive(Clone, Copy, PartialEq, RustcEncodable, RustcDecodable, Debug)]
#[derive(Clone, Copy, PartialEq, RustcEncodable, RustcDecodable, Debug, HashStable_Generic)]
pub struct Lit {
pub kind: LitKind,
pub symbol: Symbol,