-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Use proc-macro to derive HashStable everywhere #66279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
3e969e0
1de5fdb
640797f
bf7c9ba
3c5ddfd
0073d3b
31298b4
e85c195
8c86a79
edc5232
9efd320
ce30107
ea0c354
7e411e7
4d1674f
782cc9f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ use syntax_pos::symbol::{kw, sym, Symbol}; | |
use syntax_pos::{Span, DUMMY_SP, ExpnId}; | ||
|
||
use rustc_data_structures::fx::FxHashSet; | ||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; | ||
use rustc_data_structures::sync::Lrc; | ||
use rustc_data_structures::thin_vec::ThinVec; | ||
use rustc_index::vec::Idx; | ||
|
@@ -112,6 +113,15 @@ impl PartialEq<Symbol> for Path { | |
} | ||
} | ||
|
||
impl<CTX> HashStable<CTX> for Path { | ||
fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher) { | ||
self.segments.len().hash_stable(hcx, hasher); | ||
for segment in &self.segments { | ||
segment.ident.name.hash_stable(hcx, hasher); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @michaelwoerister This skips all the other fields in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like the NodeId field was added later and the whole implementation was lifted to a more general context in 759bd01. It would be good to hash the generic arguments too. |
||
} | ||
} | ||
} | ||
|
||
impl Path { | ||
// Convert a span and an identifier to the corresponding | ||
// one-segment path. | ||
|
@@ -1411,7 +1421,7 @@ pub enum StrStyle { | |
} | ||
|
||
/// An AST literal. | ||
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] | ||
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable_Generic)] | ||
pub struct Lit { | ||
/// The original literal token as written in source code. | ||
pub token: token::Lit, | ||
|
@@ -2266,7 +2276,7 @@ impl rustc_serialize::Decodable for AttrId { | |
} | ||
} | ||
|
||
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] | ||
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable_Generic)] | ||
pub struct AttrItem { | ||
pub path: Path, | ||
pub tokens: TokenStream, | ||
|
Uh oh!
There was an error while loading. Please reload this page.