Skip to content

Commit a265bc2

Browse files
committed
HashStable_Generic for libsyntax_pos.
1 parent 2a67986 commit a265bc2

File tree

4 files changed

+12
-54
lines changed

4 files changed

+12
-54
lines changed

src/librustc/ich/impls_syntax.rs

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ impl_stable_hash_for!(enum ::rustc_target::spec::abi::Abi {
4040
Unadjusted
4141
});
4242

43-
impl_stable_hash_for!(enum ::syntax::edition::Edition {
44-
Edition2015,
45-
Edition2018,
46-
});
47-
4843
impl_stable_hash_for!(struct ::syntax::ast::Lit {
4944
kind,
5045
token,
@@ -222,12 +217,6 @@ impl_stable_hash_for!(enum ::syntax::ast::MetaItemKind {
222217
NameValue(lit)
223218
});
224219

225-
impl_stable_hash_for!(enum ::syntax_pos::hygiene::Transparency {
226-
Transparent,
227-
SemiTransparent,
228-
Opaque,
229-
});
230-
231220
impl_stable_hash_for!(struct ::syntax_pos::hygiene::ExpnData {
232221
kind,
233222
parent -> _,
@@ -239,43 +228,6 @@ impl_stable_hash_for!(struct ::syntax_pos::hygiene::ExpnData {
239228
edition
240229
});
241230

242-
impl_stable_hash_for!(enum ::syntax_pos::hygiene::ExpnKind {
243-
Root,
244-
Macro(kind, descr),
245-
AstPass(kind),
246-
Desugaring(kind)
247-
});
248-
249-
impl_stable_hash_for!(enum ::syntax_pos::hygiene::AstPass {
250-
StdImports,
251-
TestHarness,
252-
ProcMacroHarness,
253-
PluginMacroDefs,
254-
});
255-
256-
impl_stable_hash_for!(enum ::syntax_pos::hygiene::DesugaringKind {
257-
CondTemporary,
258-
Async,
259-
Await,
260-
QuestionMark,
261-
OpaqueTy,
262-
ForLoop,
263-
TryBlock
264-
});
265-
266-
impl_stable_hash_for!(enum ::syntax_pos::FileName {
267-
Real(pb),
268-
Macros(s),
269-
QuoteExpansion(s),
270-
Anon(s),
271-
MacroExpansion(s),
272-
ProcMacroSourceCode(s),
273-
CliCrateAttr(s),
274-
CfgSpec(s),
275-
Custom(s),
276-
DocTest(pb, line),
277-
});
278-
279231
impl<'a> HashStable<StableHashingContext<'a>> for SourceFile {
280232
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
281233
let SourceFile {

src/libsyntax_pos/edition.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ use crate::symbol::{Symbol, sym};
22
use std::fmt;
33
use std::str::FromStr;
44

5+
use rustc_macros::HashStable_Generic;
6+
57
/// The edition of the compiler (RFC 2052)
6-
#[derive(Clone, Copy, Hash, PartialEq, PartialOrd, Debug, RustcEncodable, RustcDecodable, Eq)]
8+
#[derive(Clone, Copy, Hash, PartialEq, PartialOrd, Debug,
9+
RustcEncodable, RustcDecodable, Eq, HashStable_Generic)]
710
pub enum Edition {
811
// editions must be kept in order, oldest to newest
912

src/libsyntax_pos/hygiene.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ pub struct ExpnId(u32);
5959

6060
/// A property of a macro expansion that determines how identifiers
6161
/// produced by that expansion are resolved.
62-
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Hash, Debug, RustcEncodable, RustcDecodable)]
62+
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Hash, Debug,
63+
RustcEncodable, RustcDecodable, HashStable_Generic)]
6364
pub enum Transparency {
6465
/// Identifier produced by a transparent expansion is always resolved at call-site.
6566
/// Call-site spans in procedural macros, hygiene opt-out in `macro` should use this.
@@ -684,7 +685,7 @@ impl ExpnData {
684685
}
685686

686687
/// Expansion kind.
687-
#[derive(Clone, Debug, RustcEncodable, RustcDecodable)]
688+
#[derive(Clone, Debug, RustcEncodable, RustcDecodable, HashStable_Generic)]
688689
pub enum ExpnKind {
689690
/// No expansion, aka root expansion. Only `ExpnId::root()` has this kind.
690691
Root,
@@ -744,7 +745,7 @@ impl MacroKind {
744745
}
745746

746747
/// The kind of AST transform.
747-
#[derive(Clone, Copy, PartialEq, Debug, RustcEncodable, RustcDecodable)]
748+
#[derive(Clone, Copy, PartialEq, Debug, RustcEncodable, RustcDecodable, HashStable_Generic)]
748749
pub enum AstPass {
749750
StdImports,
750751
TestHarness,
@@ -764,7 +765,7 @@ impl AstPass {
764765
}
765766

766767
/// The kind of compiler desugaring.
767-
#[derive(Clone, Copy, PartialEq, Debug, RustcEncodable, RustcDecodable)]
768+
#[derive(Clone, Copy, PartialEq, Debug, RustcEncodable, RustcDecodable, HashStable_Generic)]
768769
pub enum DesugaringKind {
769770
/// We desugar `if c { i } else { e }` to `match $ExprKind::Use(c) { true => i, _ => e }`.
770771
/// However, we do not want to blame `c` for unreachability but rather say that `i`

src/libsyntax_pos/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#![feature(step_trait)]
1616

1717
use rustc_serialize::{Encodable, Decodable, Encoder, Decoder};
18+
use rustc_macros::HashStable_Generic;
1819

1920
pub mod source_map;
2021

@@ -66,7 +67,8 @@ impl Globals {
6667
scoped_tls::scoped_thread_local!(pub static GLOBALS: Globals);
6768

6869
/// Differentiates between real files and common virtual files.
69-
#[derive(Debug, Eq, PartialEq, Clone, Ord, PartialOrd, Hash, RustcDecodable, RustcEncodable)]
70+
#[derive(Debug, Eq, PartialEq, Clone, Ord, PartialOrd, Hash,
71+
RustcDecodable, RustcEncodable, HashStable_Generic)]
7072
pub enum FileName {
7173
Real(PathBuf),
7274
/// A macro. This includes the full name of the macro, so that there are no clashes.

0 commit comments

Comments
 (0)