@@ -20,7 +20,7 @@ use rustc_serialize::opaque::{FileEncodeResult, FileEncoder, IntEncodedWithFixed
20
20
use rustc_serialize:: { Decodable , Decoder , Encodable , Encoder } ;
21
21
use rustc_session:: Session ;
22
22
use rustc_span:: hygiene:: {
23
- ExpnId , HygieneDecodeContext , HygieneEncodeContext , SyntaxContext , SyntaxContextData ,
23
+ ExpnId , HygieneDecodeContext , HygieneEncodeContext , SyntaxContext , SyntaxContextKey ,
24
24
} ;
25
25
use rustc_span:: source_map:: SourceMap ;
26
26
use rustc_span:: {
@@ -36,7 +36,7 @@ const TAG_FULL_SPAN: u8 = 0;
36
36
const TAG_PARTIAL_SPAN : u8 = 1 ;
37
37
const TAG_RELATIVE_SPAN : u8 = 2 ;
38
38
39
- const TAG_SYNTAX_CONTEXT : u8 = 0 ;
39
+ const TAG_SYNTAX_CONTEXT_KEY : u8 = 0 ;
40
40
const TAG_EXPN_DATA : u8 = 1 ;
41
41
42
42
// Tags for encoding Symbol's
@@ -77,7 +77,7 @@ pub struct OnDiskCache<'sess> {
77
77
// to represent the fact that we are storing *encoded* ids. When we decode
78
78
// a `SyntaxContext`, a new id will be allocated from the global `HygieneData`,
79
79
// which will almost certainly be different than the serialized id.
80
- syntax_contexts : FxHashMap < u32 , AbsoluteBytePos > ,
80
+ syntax_context_keys : FxHashMap < u32 , AbsoluteBytePos > ,
81
81
// A map from the `DefPathHash` of an `ExpnId` to the position
82
82
// of their associated `ExpnData`. Ideally, we would store a `DefId`,
83
83
// but we need to decode this before we've constructed a `TyCtxt` (which
@@ -108,7 +108,7 @@ struct Footer {
108
108
// without measurable overhead. This permits larger const allocations without ICEing.
109
109
interpret_alloc_index : Vec < u64 > ,
110
110
// See `OnDiskCache.syntax_contexts`
111
- syntax_contexts : FxHashMap < u32 , AbsoluteBytePos > ,
111
+ syntax_context_keys : FxHashMap < u32 , AbsoluteBytePos > ,
112
112
// See `OnDiskCache.expn_data`
113
113
expn_data : UnhashMap < ExpnHash , AbsoluteBytePos > ,
114
114
foreign_expn_data : UnhashMap < ExpnHash , u32 > ,
@@ -179,7 +179,7 @@ impl<'sess> OnDiskCache<'sess> {
179
179
query_result_index : footer. query_result_index . into_iter ( ) . collect ( ) ,
180
180
prev_side_effects_index : footer. side_effects_index . into_iter ( ) . collect ( ) ,
181
181
alloc_decoding_state : AllocDecodingState :: new ( footer. interpret_alloc_index ) ,
182
- syntax_contexts : footer. syntax_contexts ,
182
+ syntax_context_keys : footer. syntax_context_keys ,
183
183
expn_data : footer. expn_data ,
184
184
foreign_expn_data : footer. foreign_expn_data ,
185
185
hygiene_context : Default :: default ( ) ,
@@ -196,7 +196,7 @@ impl<'sess> OnDiskCache<'sess> {
196
196
query_result_index : Default :: default ( ) ,
197
197
prev_side_effects_index : Default :: default ( ) ,
198
198
alloc_decoding_state : AllocDecodingState :: new ( Vec :: new ( ) ) ,
199
- syntax_contexts : FxHashMap :: default ( ) ,
199
+ syntax_context_keys : FxHashMap :: default ( ) ,
200
200
expn_data : UnhashMap :: default ( ) ,
201
201
foreign_expn_data : UnhashMap :: default ( ) ,
202
202
hygiene_context : Default :: default ( ) ,
@@ -301,7 +301,7 @@ impl<'sess> OnDiskCache<'sess> {
301
301
interpret_alloc_index
302
302
} ;
303
303
304
- let mut syntax_contexts = FxHashMap :: default ( ) ;
304
+ let mut syntax_context_keys = FxHashMap :: default ( ) ;
305
305
let mut expn_data = UnhashMap :: default ( ) ;
306
306
let mut foreign_expn_data = UnhashMap :: default ( ) ;
307
307
@@ -312,8 +312,8 @@ impl<'sess> OnDiskCache<'sess> {
312
312
& mut encoder,
313
313
|encoder, index, ctxt_data| {
314
314
let pos = AbsoluteBytePos :: new ( encoder. position ( ) ) ;
315
- encoder. encode_tagged ( TAG_SYNTAX_CONTEXT , ctxt_data) ;
316
- syntax_contexts . insert ( index, pos) ;
315
+ encoder. encode_tagged ( TAG_SYNTAX_CONTEXT_KEY , & ctxt_data) ;
316
+ syntax_context_keys . insert ( index, pos) ;
317
317
} ,
318
318
|encoder, expn_id, data, hash| {
319
319
if expn_id. krate == LOCAL_CRATE {
@@ -335,7 +335,7 @@ impl<'sess> OnDiskCache<'sess> {
335
335
query_result_index,
336
336
side_effects_index,
337
337
interpret_alloc_index,
338
- syntax_contexts ,
338
+ syntax_context_keys ,
339
339
expn_data,
340
340
foreign_expn_data,
341
341
} ,
@@ -442,7 +442,7 @@ impl<'sess> OnDiskCache<'sess> {
442
442
file_index_to_file : & self . file_index_to_file ,
443
443
file_index_to_stable_id : & self . file_index_to_stable_id ,
444
444
alloc_decoding_session : self . alloc_decoding_state . new_decoding_session ( ) ,
445
- syntax_contexts : & self . syntax_contexts ,
445
+ syntax_context_keys : & self . syntax_context_keys ,
446
446
expn_data : & self . expn_data ,
447
447
foreign_expn_data : & self . foreign_expn_data ,
448
448
hygiene_context : & self . hygiene_context ,
@@ -463,7 +463,7 @@ pub struct CacheDecoder<'a, 'tcx> {
463
463
file_index_to_file : & ' a Lock < FxHashMap < SourceFileIndex , Lrc < SourceFile > > > ,
464
464
file_index_to_stable_id : & ' a FxHashMap < SourceFileIndex , EncodedSourceFileId > ,
465
465
alloc_decoding_session : AllocDecodingSession < ' a > ,
466
- syntax_contexts : & ' a FxHashMap < u32 , AbsoluteBytePos > ,
466
+ syntax_context_keys : & ' a FxHashMap < u32 , AbsoluteBytePos > ,
467
467
expn_data : & ' a UnhashMap < ExpnHash , AbsoluteBytePos > ,
468
468
foreign_expn_data : & ' a UnhashMap < ExpnHash , u32 > ,
469
469
hygiene_context : & ' a HygieneDecodeContext ,
@@ -584,13 +584,12 @@ impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>> for Vec<u8> {
584
584
585
585
impl < ' a , ' tcx > SpanDecoder for CacheDecoder < ' a , ' tcx > {
586
586
fn decode_syntax_context ( & mut self ) -> SyntaxContext {
587
- let syntax_contexts = self . syntax_contexts ;
588
587
rustc_span:: hygiene:: decode_syntax_context ( self , self . hygiene_context , |this, id| {
589
588
// This closure is invoked if we haven't already decoded the data for the `SyntaxContext` we are deserializing.
590
589
// We look up the position of the associated `SyntaxData` and decode it.
591
- let pos = syntax_contexts . get ( & id) . unwrap ( ) ;
590
+ let pos = this . syntax_context_keys . get ( & id) . unwrap ( ) ;
592
591
this. with_position ( pos. to_usize ( ) , |decoder| {
593
- let data: SyntaxContextData = decode_tagged ( decoder, TAG_SYNTAX_CONTEXT ) ;
592
+ let data: SyntaxContextKey = decode_tagged ( decoder, TAG_SYNTAX_CONTEXT_KEY ) ;
594
593
data
595
594
} )
596
595
} )
0 commit comments