Skip to content

Commit

Permalink
no hash for the query result
Browse files Browse the repository at this point in the history
does not compile after rebase (by @futile)

Co-authored-by: Felix Rath <[email protected]>
  • Loading branch information
SparrowLii and futile committed Aug 5, 2024
1 parent b6b27f0 commit 0098721
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
12 changes: 3 additions & 9 deletions compiler/rustc_ast/src/token.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::borrow::Cow;
use std::fmt;
use std::hash::{Hash, Hasher};
use std::hash::Hash;

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

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

#[derive(Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic, Hash)]
#[derive(Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]
pub struct Token {
pub kind: TokenKind,
pub span: Span,
Expand Down Expand Up @@ -1061,12 +1061,6 @@ where
}
}

impl Hash for Nonterminal {
fn hash<H: Hasher>(&self, _state: &mut H) {
panic!("interpolated tokens should not be present in the HIR")
}
}

// Some types are used a lot. Make sure they don't unintentionally get bigger.
#[cfg(target_pointer_width = "64")]
mod size_asserts {
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_ast/src/tokenstream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//! ownership of the original.
use std::borrow::Cow;
use std::hash::{Hash, Hasher};
use std::hash::Hash;
use std::{cmp, fmt, iter};

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

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

impl Hash for TokenStream {
/*impl Hash for TokenStream {
fn hash<H: Hasher>(&self, state: &mut H) {
for sub_tt in self.trees() {
sub_tt.hash(state);
}
}
}
}*/

pub trait ToAttrTokenStream: sync::DynSend + sync::DynSync {
fn to_attr_token_stream(&self) -> AttrTokenStream;
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_middle/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ rustc_queries! {

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

Expand Down

0 comments on commit 0098721

Please sign in to comment.