@@ -16,7 +16,7 @@ use rustc_serialize::opaque::{FileEncodeResult, FileEncoder, IntEncodedWithFixed
16
16
use rustc_serialize:: { Decodable , Decoder , Encodable , Encoder } ;
17
17
use rustc_session:: Session ;
18
18
use rustc_span:: hygiene:: {
19
- ExpnId , HygieneDecodeContext , HygieneEncodeContext , SyntaxContext , SyntaxContextData ,
19
+ ExpnId , HygieneDecodeContext , HygieneEncodeContext , SyntaxContext , SyntaxContextKey ,
20
20
} ;
21
21
use rustc_span:: source_map:: Spanned ;
22
22
use rustc_span:: {
@@ -39,7 +39,7 @@ const TAG_FULL_SPAN: u8 = 0;
39
39
const TAG_PARTIAL_SPAN : u8 = 1 ;
40
40
const TAG_RELATIVE_SPAN : u8 = 2 ;
41
41
42
- const TAG_SYNTAX_CONTEXT : u8 = 0 ;
42
+ const TAG_SYNTAX_CONTEXT_KEY : u8 = 0 ;
43
43
const TAG_EXPN_DATA : u8 = 1 ;
44
44
45
45
// Tags for encoding Symbol's
@@ -79,7 +79,7 @@ pub struct OnDiskCache {
79
79
// to represent the fact that we are storing *encoded* ids. When we decode
80
80
// a `SyntaxContext`, a new id will be allocated from the global `HygieneData`,
81
81
// which will almost certainly be different than the serialized id.
82
- syntax_contexts : FxHashMap < u32 , AbsoluteBytePos > ,
82
+ syntax_context_keys : FxHashMap < u32 , AbsoluteBytePos > ,
83
83
// A map from the `DefPathHash` of an `ExpnId` to the position
84
84
// of their associated `ExpnData`. Ideally, we would store a `DefId`,
85
85
// but we need to decode this before we've constructed a `TyCtxt` (which
@@ -110,7 +110,7 @@ struct Footer {
110
110
// without measurable overhead. This permits larger const allocations without ICEing.
111
111
interpret_alloc_index : Vec < u64 > ,
112
112
// See `OnDiskCache.syntax_contexts`
113
- syntax_contexts : FxHashMap < u32 , AbsoluteBytePos > ,
113
+ syntax_context_keys : FxHashMap < u32 , AbsoluteBytePos > ,
114
114
// See `OnDiskCache.expn_data`
115
115
expn_data : UnhashMap < ExpnHash , AbsoluteBytePos > ,
116
116
foreign_expn_data : UnhashMap < ExpnHash , u32 > ,
@@ -180,7 +180,7 @@ impl OnDiskCache {
180
180
query_result_index : footer. query_result_index . into_iter ( ) . collect ( ) ,
181
181
prev_side_effects_index : footer. side_effects_index . into_iter ( ) . collect ( ) ,
182
182
alloc_decoding_state : AllocDecodingState :: new ( footer. interpret_alloc_index ) ,
183
- syntax_contexts : footer. syntax_contexts ,
183
+ syntax_context_keys : footer. syntax_context_keys ,
184
184
expn_data : footer. expn_data ,
185
185
foreign_expn_data : footer. foreign_expn_data ,
186
186
hygiene_context : Default :: default ( ) ,
@@ -196,7 +196,7 @@ impl OnDiskCache {
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 OnDiskCache {
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 OnDiskCache {
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 OnDiskCache {
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
} ,
@@ -441,7 +441,7 @@ impl OnDiskCache {
441
441
file_index_to_file : & self . file_index_to_file ,
442
442
file_index_to_stable_id : & self . file_index_to_stable_id ,
443
443
alloc_decoding_session : self . alloc_decoding_state . new_decoding_session ( ) ,
444
- syntax_contexts : & self . syntax_contexts ,
444
+ syntax_context_keys : & self . syntax_context_keys ,
445
445
expn_data : & self . expn_data ,
446
446
foreign_expn_data : & self . foreign_expn_data ,
447
447
hygiene_context : & self . hygiene_context ,
@@ -461,7 +461,7 @@ pub struct CacheDecoder<'a, 'tcx> {
461
461
file_index_to_file : & ' a Lock < FxHashMap < SourceFileIndex , Arc < SourceFile > > > ,
462
462
file_index_to_stable_id : & ' a FxHashMap < SourceFileIndex , EncodedSourceFileId > ,
463
463
alloc_decoding_session : AllocDecodingSession < ' a > ,
464
- syntax_contexts : & ' a FxHashMap < u32 , AbsoluteBytePos > ,
464
+ syntax_context_keys : & ' a FxHashMap < u32 , AbsoluteBytePos > ,
465
465
expn_data : & ' a UnhashMap < ExpnHash , AbsoluteBytePos > ,
466
466
foreign_expn_data : & ' a UnhashMap < ExpnHash , u32 > ,
467
467
hygiene_context : & ' a HygieneDecodeContext ,
@@ -576,13 +576,12 @@ impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>> for Vec<u8> {
576
576
577
577
impl < ' a , ' tcx > SpanDecoder for CacheDecoder < ' a , ' tcx > {
578
578
fn decode_syntax_context ( & mut self ) -> SyntaxContext {
579
- let syntax_contexts = self . syntax_contexts ;
580
579
rustc_span:: hygiene:: decode_syntax_context ( self , self . hygiene_context , |this, id| {
581
580
// This closure is invoked if we haven't already decoded the data for the `SyntaxContext` we are deserializing.
582
581
// We look up the position of the associated `SyntaxData` and decode it.
583
- let pos = syntax_contexts . get ( & id) . unwrap ( ) ;
582
+ let pos = this . syntax_context_keys . get ( & id) . unwrap ( ) ;
584
583
this. with_position ( pos. to_usize ( ) , |decoder| {
585
- let data: SyntaxContextData = decode_tagged ( decoder, TAG_SYNTAX_CONTEXT ) ;
584
+ let data: SyntaxContextKey = decode_tagged ( decoder, TAG_SYNTAX_CONTEXT_KEY ) ;
586
585
data
587
586
} )
588
587
} )
0 commit comments