Remove most of Hash
impls from AST and HIR structures
This commit is contained in:
parent
4d1a30c92b
commit
5987fe8f75
7 changed files with 208 additions and 210 deletions
|
@ -33,10 +33,9 @@ use util::RcSlice;
|
|||
|
||||
use std::borrow::Cow;
|
||||
use std::{fmt, iter, mem};
|
||||
use std::hash::{self, Hash};
|
||||
|
||||
/// A delimited sequence of token trees
|
||||
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
||||
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug)]
|
||||
pub struct Delimited {
|
||||
/// The type of delimiter
|
||||
pub delim: token::DelimToken,
|
||||
|
@ -93,7 +92,7 @@ impl Delimited {
|
|||
///
|
||||
/// The RHS of an MBE macro is the only place `SubstNt`s are substituted.
|
||||
/// Nothing special happens to misnamed or misplaced `SubstNt`s.
|
||||
#[derive(Debug, Clone, PartialEq, RustcEncodable, RustcDecodable, Hash)]
|
||||
#[derive(Debug, Clone, PartialEq, RustcEncodable, RustcDecodable)]
|
||||
pub enum TokenTree {
|
||||
/// A single token
|
||||
Token(Span, token::Token),
|
||||
|
@ -605,14 +604,6 @@ impl Decodable for TokenStream {
|
|||
}
|
||||
}
|
||||
|
||||
impl Hash for TokenStream {
|
||||
fn hash<H: hash::Hasher>(&self, state: &mut H) {
|
||||
for tree in self.trees() {
|
||||
tree.hash(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Encodable for ThinTokenStream {
|
||||
fn encode<E: Encoder>(&self, encoder: &mut E) -> Result<(), E::Error> {
|
||||
TokenStream::from(self.clone()).encode(encoder)
|
||||
|
@ -625,13 +616,6 @@ impl Decodable for ThinTokenStream {
|
|||
}
|
||||
}
|
||||
|
||||
impl Hash for ThinTokenStream {
|
||||
fn hash<H: hash::Hasher>(&self, state: &mut H) {
|
||||
TokenStream::from(self.clone()).hash(state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue