@@ -10,168 +10,22 @@ use syntax::ast;
10
10
use syntax:: feature_gate;
11
11
use syntax:: token;
12
12
use syntax:: tokenstream;
13
- use syntax_pos:: symbol:: SymbolStr ;
14
13
use syntax_pos:: SourceFile ;
15
14
16
15
use crate :: hir:: def_id:: { DefId , CrateNum , CRATE_DEF_INDEX } ;
17
16
18
17
use smallvec:: SmallVec ;
19
- use rustc_data_structures:: stable_hasher:: { HashStable , ToStableHashKey , StableHasher } ;
20
-
21
- impl < ' a > HashStable < StableHashingContext < ' a > > for SymbolStr {
22
- #[ inline]
23
- fn hash_stable ( & self , hcx : & mut StableHashingContext < ' a > , hasher : & mut StableHasher ) {
24
- let str = self as & str ;
25
- str. hash_stable ( hcx, hasher)
26
- }
27
- }
28
-
29
- impl < ' a > ToStableHashKey < StableHashingContext < ' a > > for SymbolStr {
30
- type KeyType = SymbolStr ;
31
-
32
- #[ inline]
33
- fn to_stable_hash_key ( & self ,
34
- _: & StableHashingContext < ' a > )
35
- -> SymbolStr {
36
- self . clone ( )
37
- }
38
- }
39
-
40
- impl < ' a > HashStable < StableHashingContext < ' a > > for ast:: Name {
41
- #[ inline]
42
- fn hash_stable ( & self , hcx : & mut StableHashingContext < ' a > , hasher : & mut StableHasher ) {
43
- self . as_str ( ) . hash_stable ( hcx, hasher) ;
44
- }
45
- }
46
-
47
- impl < ' a > ToStableHashKey < StableHashingContext < ' a > > for ast:: Name {
48
- type KeyType = SymbolStr ;
49
-
50
- #[ inline]
51
- fn to_stable_hash_key ( & self ,
52
- _: & StableHashingContext < ' a > )
53
- -> SymbolStr {
54
- self . as_str ( )
55
- }
56
- }
57
-
58
- impl_stable_hash_for ! ( enum :: syntax:: ast:: AsmDialect {
59
- Att ,
60
- Intel
61
- } ) ;
62
-
63
- impl_stable_hash_for ! ( enum :: syntax_pos:: hygiene:: MacroKind {
64
- Bang ,
65
- Attr ,
66
- Derive ,
67
- } ) ;
68
-
69
-
70
- impl_stable_hash_for ! ( enum :: rustc_target:: spec:: abi:: Abi {
71
- Cdecl ,
72
- Stdcall ,
73
- Fastcall ,
74
- Vectorcall ,
75
- Thiscall ,
76
- Aapcs ,
77
- Win64 ,
78
- SysV64 ,
79
- PtxKernel ,
80
- Msp430Interrupt ,
81
- X86Interrupt ,
82
- AmdGpuKernel ,
83
- EfiApi ,
84
- Rust ,
85
- C ,
86
- System ,
87
- RustIntrinsic ,
88
- RustCall ,
89
- PlatformIntrinsic ,
90
- Unadjusted
91
- } ) ;
92
-
93
- impl_stable_hash_for ! ( struct :: syntax:: attr:: Deprecation { since, note } ) ;
94
- impl_stable_hash_for ! ( struct :: syntax:: attr:: Stability {
95
- level,
96
- feature,
97
- rustc_depr,
98
- promotable,
99
- allow_const_fn_ptr,
100
- const_stability
101
- } ) ;
102
-
103
- impl_stable_hash_for ! ( enum :: syntax:: edition:: Edition {
104
- Edition2015 ,
105
- Edition2018 ,
106
- } ) ;
107
-
108
- impl < ' a > HashStable < StableHashingContext < ' a > >
109
- for :: syntax:: attr:: StabilityLevel {
110
- fn hash_stable ( & self , hcx : & mut StableHashingContext < ' a > , hasher : & mut StableHasher ) {
111
- mem:: discriminant ( self ) . hash_stable ( hcx, hasher) ;
112
- match * self {
113
- :: syntax:: attr:: StabilityLevel :: Unstable { ref reason, ref issue, ref is_soft } => {
114
- reason. hash_stable ( hcx, hasher) ;
115
- issue. hash_stable ( hcx, hasher) ;
116
- is_soft. hash_stable ( hcx, hasher) ;
117
- }
118
- :: syntax:: attr:: StabilityLevel :: Stable { ref since } => {
119
- since. hash_stable ( hcx, hasher) ;
120
- }
121
- }
122
- }
123
- }
124
-
125
- impl_stable_hash_for ! ( struct :: syntax:: attr:: RustcDeprecation { since, reason, suggestion } ) ;
126
-
127
- impl_stable_hash_for ! ( enum :: syntax:: attr:: IntType {
128
- SignedInt ( int_ty) ,
129
- UnsignedInt ( uint_ty)
130
- } ) ;
131
-
132
- impl_stable_hash_for ! ( enum :: syntax:: ast:: LitIntType {
133
- Signed ( int_ty) ,
134
- Unsigned ( int_ty) ,
135
- Unsuffixed
136
- } ) ;
137
-
138
- impl_stable_hash_for ! ( enum :: syntax:: ast:: LitFloatType {
139
- Suffixed ( float_ty) ,
140
- Unsuffixed
141
- } ) ;
18
+ use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
142
19
143
20
impl_stable_hash_for ! ( struct :: syntax:: ast:: Lit {
144
21
kind,
145
22
token,
146
23
span
147
24
} ) ;
148
25
149
- impl_stable_hash_for ! ( enum :: syntax:: ast:: LitKind {
150
- Str ( value, style) ,
151
- ByteStr ( value) ,
152
- Byte ( value) ,
153
- Char ( value) ,
154
- Int ( value, lit_int_type) ,
155
- Float ( value, lit_float_type) ,
156
- Bool ( value) ,
157
- Err ( value)
158
- } ) ;
159
-
160
26
impl_stable_hash_for_spanned ! ( :: syntax:: ast:: LitKind ) ;
161
27
162
- impl_stable_hash_for ! ( enum :: syntax:: ast:: IntTy { Isize , I8 , I16 , I32 , I64 , I128 } ) ;
163
- impl_stable_hash_for ! ( enum :: syntax:: ast:: UintTy { Usize , U8 , U16 , U32 , U64 , U128 } ) ;
164
- impl_stable_hash_for ! ( enum :: syntax:: ast:: FloatTy { F32 , F64 } ) ;
165
- impl_stable_hash_for ! ( enum :: syntax:: ast:: Unsafety { Unsafe , Normal } ) ;
166
- impl_stable_hash_for ! ( enum :: syntax:: ast:: Constness { Const , NotConst } ) ;
167
- impl_stable_hash_for ! ( enum :: syntax:: ast:: Defaultness { Default , Final } ) ;
168
28
impl_stable_hash_for ! ( struct :: syntax:: ast:: Lifetime { id, ident } ) ;
169
- impl_stable_hash_for ! ( enum :: syntax:: ast:: StrStyle { Cooked , Raw ( pounds) } ) ;
170
- impl_stable_hash_for ! ( enum :: syntax:: ast:: AttrStyle { Outer , Inner } ) ;
171
- impl_stable_hash_for ! ( enum :: syntax:: ast:: Movability { Static , Movable } ) ;
172
- impl_stable_hash_for ! ( enum :: syntax:: ast:: CaptureBy { Value , Ref } ) ;
173
- impl_stable_hash_for ! ( enum :: syntax:: ast:: IsAuto { Yes , No } ) ;
174
- impl_stable_hash_for ! ( enum :: syntax:: ast:: ImplPolarity { Positive , Negative } ) ;
175
29
176
30
impl < ' a > HashStable < StableHashingContext < ' a > > for [ ast:: Attribute ] {
177
31
fn hash_stable ( & self , hcx : & mut StableHashingContext < ' a > , hasher : & mut StableHasher ) {
@@ -255,25 +109,6 @@ for tokenstream::TokenStream {
255
109
}
256
110
}
257
111
258
- impl_stable_hash_for ! ( enum token:: LitKind {
259
- Bool ,
260
- Byte ,
261
- Char ,
262
- Integer ,
263
- Float ,
264
- Str ,
265
- ByteStr ,
266
- StrRaw ( n) ,
267
- ByteStrRaw ( n) ,
268
- Err
269
- } ) ;
270
-
271
- impl_stable_hash_for ! ( struct token:: Lit {
272
- kind,
273
- symbol,
274
- suffix
275
- } ) ;
276
-
277
112
impl < ' a > HashStable < StableHashingContext < ' a > > for token:: TokenKind {
278
113
fn hash_stable ( & self , hcx : & mut StableHashingContext < ' a > , hasher : & mut StableHasher ) {
279
114
mem:: discriminant ( self ) . hash_stable ( hcx, hasher) ;
@@ -359,12 +194,6 @@ impl_stable_hash_for!(enum ::syntax::ast::MetaItemKind {
359
194
NameValue ( lit)
360
195
} ) ;
361
196
362
- impl_stable_hash_for ! ( enum :: syntax_pos:: hygiene:: Transparency {
363
- Transparent ,
364
- SemiTransparent ,
365
- Opaque ,
366
- } ) ;
367
-
368
197
impl_stable_hash_for ! ( struct :: syntax_pos:: hygiene:: ExpnData {
369
198
kind,
370
199
parent -> _,
@@ -376,43 +205,6 @@ impl_stable_hash_for!(struct ::syntax_pos::hygiene::ExpnData {
376
205
edition
377
206
} ) ;
378
207
379
- impl_stable_hash_for ! ( enum :: syntax_pos:: hygiene:: ExpnKind {
380
- Root ,
381
- Macro ( kind, descr) ,
382
- AstPass ( kind) ,
383
- Desugaring ( kind)
384
- } ) ;
385
-
386
- impl_stable_hash_for ! ( enum :: syntax_pos:: hygiene:: AstPass {
387
- StdImports ,
388
- TestHarness ,
389
- ProcMacroHarness ,
390
- PluginMacroDefs ,
391
- } ) ;
392
-
393
- impl_stable_hash_for ! ( enum :: syntax_pos:: hygiene:: DesugaringKind {
394
- CondTemporary ,
395
- Async ,
396
- Await ,
397
- QuestionMark ,
398
- OpaqueTy ,
399
- ForLoop ,
400
- TryBlock
401
- } ) ;
402
-
403
- impl_stable_hash_for ! ( enum :: syntax_pos:: FileName {
404
- Real ( pb) ,
405
- Macros ( s) ,
406
- QuoteExpansion ( s) ,
407
- Anon ( s) ,
408
- MacroExpansion ( s) ,
409
- ProcMacroSourceCode ( s) ,
410
- CliCrateAttr ( s) ,
411
- CfgSpec ( s) ,
412
- Custom ( s) ,
413
- DocTest ( pb, line) ,
414
- } ) ;
415
-
416
208
impl < ' a > HashStable < StableHashingContext < ' a > > for SourceFile {
417
209
fn hash_stable ( & self , hcx : & mut StableHashingContext < ' a > , hasher : & mut StableHasher ) {
418
210
let SourceFile {
0 commit comments