Skip to content

Commit dc87f47

Browse files
committed
not hash for tokenstream
1 parent df4ce78 commit dc87f47

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

compiler/rustc_ast/src/token.rs

+3-9
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use rustc_span::symbol::{Ident, Symbol};
1717
use rustc_span::{edition::Edition, ErrorGuaranteed, Span, DUMMY_SP};
1818
use std::borrow::Cow;
1919
use std::fmt;
20-
use std::hash::{Hash, Hasher};
20+
use std::hash::Hash;
2121

2222
#[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug, HashStable_Generic, Hash)]
2323
pub enum CommentKind {
@@ -245,7 +245,7 @@ impl From<IdentIsRaw> for bool {
245245

246246
// SAFETY: due to the `Clone` impl below, all fields of all variants other than
247247
// `Interpolated` must impl `Copy`.
248-
#[derive(PartialEq, Encodable, Decodable, Debug, HashStable_Generic, Hash)]
248+
#[derive(PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]
249249
pub enum TokenKind {
250250
/* Expression-operator symbols. */
251251
/// `=`
@@ -371,7 +371,7 @@ impl Clone for TokenKind {
371371
}
372372
}
373373

374-
#[derive(Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic, Hash)]
374+
#[derive(Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]
375375
pub struct Token {
376376
pub kind: TokenKind,
377377
pub span: Span,
@@ -1019,12 +1019,6 @@ where
10191019
}
10201020
}
10211021

1022-
impl Hash for Nonterminal {
1023-
fn hash<H: Hasher>(&self, _state: &mut H) {
1024-
panic!("interpolated tokens should not be present in the HIR")
1025-
}
1026-
}
1027-
10281022
// Some types are used a lot. Make sure they don't unintentionally get bigger.
10291023
#[cfg(target_pointer_width = "64")]
10301024
mod size_asserts {

compiler/rustc_ast/src/tokenstream.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ use rustc_span::{sym, Span, SpanDecoder, SpanEncoder, Symbol, DUMMY_SP};
2626
use smallvec::{smallvec, SmallVec};
2727

2828
use std::borrow::Cow;
29-
use std::hash::{Hash, Hasher};
29+
use std::hash::Hash;
3030
use std::{cmp, fmt, iter};
3131

3232
/// Part of a `TokenStream`.
33-
#[derive(Debug, Clone, PartialEq, Encodable, Decodable, HashStable_Generic, Hash)]
33+
#[derive(Debug, Clone, PartialEq, Encodable, Decodable, HashStable_Generic)]
3434
pub enum TokenTree {
3535
/// A single token. Should never be `OpenDelim` or `CloseDelim`, because
3636
/// delimiters are implicitly represented by `Delimited`.
@@ -108,13 +108,13 @@ where
108108
}
109109
}
110110

111-
impl Hash for TokenStream {
111+
/*impl Hash for TokenStream {
112112
fn hash<H: Hasher>(&self, state: &mut H) {
113113
for sub_tt in self.trees() {
114114
sub_tt.hash(state);
115115
}
116116
}
117-
}
117+
}*/
118118

119119
pub trait ToAttrTokenStream: sync::DynSend + sync::DynSync {
120120
fn to_attr_token_stream(&self) -> AttrTokenStream;

0 commit comments

Comments
 (0)