Skip to content

Commit 3399cd0

Browse files
SparrowLiifutile
andcommitted
no hash for the query result
does not compile after rebase (by @futile) Co-authored-by: Felix Rath <[email protected]>
1 parent 06dedfc commit 3399cd0

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

compiler/rustc_ast/src/token.rs

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::borrow::Cow;
22
use std::fmt;
3-
use std::hash::{Hash, Hasher};
3+
use std::hash::Hash;
44

55
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
66
use rustc_data_structures::sync::Lrc;
@@ -249,7 +249,7 @@ impl From<IdentIsRaw> for bool {
249249

250250
// SAFETY: due to the `Clone` impl below, all fields of all variants other than
251251
// `Interpolated` must impl `Copy`.
252-
#[derive(PartialEq, Encodable, Decodable, Debug, HashStable_Generic, Hash)]
252+
#[derive(PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]
253253
pub enum TokenKind {
254254
/* Expression-operator symbols. */
255255
/// `=`
@@ -375,7 +375,7 @@ impl Clone for TokenKind {
375375
}
376376
}
377377

378-
#[derive(Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic, Hash)]
378+
#[derive(Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]
379379
pub struct Token {
380380
pub kind: TokenKind,
381381
pub span: Span,
@@ -1061,12 +1061,6 @@ where
10611061
}
10621062
}
10631063

1064-
impl Hash for Nonterminal {
1065-
fn hash<H: Hasher>(&self, _state: &mut H) {
1066-
panic!("interpolated tokens should not be present in the HIR")
1067-
}
1068-
}
1069-
10701064
// Some types are used a lot. Make sure they don't unintentionally get bigger.
10711065
#[cfg(target_pointer_width = "64")]
10721066
mod size_asserts {

compiler/rustc_ast/src/tokenstream.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
//! ownership of the original.
1515
1616
use std::borrow::Cow;
17-
use std::hash::{Hash, Hasher};
17+
use std::hash::Hash;
1818
use std::{cmp, fmt, iter};
1919

2020
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
@@ -29,7 +29,7 @@ use crate::token::{self, Delimiter, Nonterminal, Token, TokenKind};
2929
use crate::{AttrVec, Attribute};
3030

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

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

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

compiler/rustc_middle/src/query/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ rustc_queries! {
113113

114114
query expand_legacy_bang(key: (LocalExpnId, Span, LocalExpnId)) -> Result<(&'tcx TokenStream, usize), CanRetry> {
115115
eval_always
116+
no_hash
116117
desc { "expand lagacy bang" }
117118
}
118119

0 commit comments

Comments
 (0)