@@ -20,7 +20,7 @@ use rustc_serialize::opaque::{FileEncodeResult, FileEncoder, IntEncodedWithFixed
2020use rustc_serialize:: { Decodable , Decoder , Encodable , Encoder } ;
2121use rustc_session:: Session ;
2222use rustc_span:: hygiene:: {
23- ExpnId , HygieneDecodeContext , HygieneEncodeContext , SyntaxContext , SyntaxContextData ,
23+ ExpnId , HygieneDecodeContext , HygieneEncodeContext , SyntaxContext , SyntaxContextKey ,
2424} ;
2525use rustc_span:: source_map:: SourceMap ;
2626use rustc_span:: {
@@ -36,7 +36,7 @@ const TAG_FULL_SPAN: u8 = 0;
3636const TAG_PARTIAL_SPAN : u8 = 1 ;
3737const TAG_RELATIVE_SPAN : u8 = 2 ;
3838
39- const TAG_SYNTAX_CONTEXT : u8 = 0 ;
39+ const TAG_SYNTAX_CONTEXT_KEY : u8 = 0 ;
4040const TAG_EXPN_DATA : u8 = 1 ;
4141
4242// Tags for encoding Symbol's
@@ -77,7 +77,7 @@ pub struct OnDiskCache<'sess> {
7777 // to represent the fact that we are storing *encoded* ids. When we decode
7878 // a `SyntaxContext`, a new id will be allocated from the global `HygieneData`,
7979 // which will almost certainly be different than the serialized id.
80- syntax_contexts : FxHashMap < u32 , AbsoluteBytePos > ,
80+ syntax_context_keys : FxHashMap < u32 , AbsoluteBytePos > ,
8181 // A map from the `DefPathHash` of an `ExpnId` to the position
8282 // of their associated `ExpnData`. Ideally, we would store a `DefId`,
8383 // but we need to decode this before we've constructed a `TyCtxt` (which
@@ -108,7 +108,7 @@ struct Footer {
108108 // without measurable overhead. This permits larger const allocations without ICEing.
109109 interpret_alloc_index : Vec < u64 > ,
110110 // See `OnDiskCache.syntax_contexts`
111- syntax_contexts : FxHashMap < u32 , AbsoluteBytePos > ,
111+ syntax_context_keys : FxHashMap < u32 , AbsoluteBytePos > ,
112112 // See `OnDiskCache.expn_data`
113113 expn_data : UnhashMap < ExpnHash , AbsoluteBytePos > ,
114114 foreign_expn_data : UnhashMap < ExpnHash , u32 > ,
@@ -179,7 +179,7 @@ impl<'sess> OnDiskCache<'sess> {
179179 query_result_index : footer. query_result_index . into_iter ( ) . collect ( ) ,
180180 prev_side_effects_index : footer. side_effects_index . into_iter ( ) . collect ( ) ,
181181 alloc_decoding_state : AllocDecodingState :: new ( footer. interpret_alloc_index ) ,
182- syntax_contexts : footer. syntax_contexts ,
182+ syntax_context_keys : footer. syntax_context_keys ,
183183 expn_data : footer. expn_data ,
184184 foreign_expn_data : footer. foreign_expn_data ,
185185 hygiene_context : Default :: default ( ) ,
@@ -196,7 +196,7 @@ impl<'sess> OnDiskCache<'sess> {
196196 query_result_index : Default :: default ( ) ,
197197 prev_side_effects_index : Default :: default ( ) ,
198198 alloc_decoding_state : AllocDecodingState :: new ( Vec :: new ( ) ) ,
199- syntax_contexts : FxHashMap :: default ( ) ,
199+ syntax_context_keys : FxHashMap :: default ( ) ,
200200 expn_data : UnhashMap :: default ( ) ,
201201 foreign_expn_data : UnhashMap :: default ( ) ,
202202 hygiene_context : Default :: default ( ) ,
@@ -301,7 +301,7 @@ impl<'sess> OnDiskCache<'sess> {
301301 interpret_alloc_index
302302 } ;
303303
304- let mut syntax_contexts = FxHashMap :: default ( ) ;
304+ let mut syntax_context_keys = FxHashMap :: default ( ) ;
305305 let mut expn_data = UnhashMap :: default ( ) ;
306306 let mut foreign_expn_data = UnhashMap :: default ( ) ;
307307
@@ -312,8 +312,8 @@ impl<'sess> OnDiskCache<'sess> {
312312 & mut encoder,
313313 |encoder, index, ctxt_data| {
314314 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) ;
317317 } ,
318318 |encoder, expn_id, data, hash| {
319319 if expn_id. krate == LOCAL_CRATE {
@@ -335,7 +335,7 @@ impl<'sess> OnDiskCache<'sess> {
335335 query_result_index,
336336 side_effects_index,
337337 interpret_alloc_index,
338- syntax_contexts ,
338+ syntax_context_keys ,
339339 expn_data,
340340 foreign_expn_data,
341341 } ,
@@ -442,7 +442,7 @@ impl<'sess> OnDiskCache<'sess> {
442442 file_index_to_file : & self . file_index_to_file ,
443443 file_index_to_stable_id : & self . file_index_to_stable_id ,
444444 alloc_decoding_session : self . alloc_decoding_state . new_decoding_session ( ) ,
445- syntax_contexts : & self . syntax_contexts ,
445+ syntax_context_keys : & self . syntax_context_keys ,
446446 expn_data : & self . expn_data ,
447447 foreign_expn_data : & self . foreign_expn_data ,
448448 hygiene_context : & self . hygiene_context ,
@@ -463,7 +463,7 @@ pub struct CacheDecoder<'a, 'tcx> {
463463 file_index_to_file : & ' a Lock < FxHashMap < SourceFileIndex , Lrc < SourceFile > > > ,
464464 file_index_to_stable_id : & ' a FxHashMap < SourceFileIndex , EncodedSourceFileId > ,
465465 alloc_decoding_session : AllocDecodingSession < ' a > ,
466- syntax_contexts : & ' a FxHashMap < u32 , AbsoluteBytePos > ,
466+ syntax_context_keys : & ' a FxHashMap < u32 , AbsoluteBytePos > ,
467467 expn_data : & ' a UnhashMap < ExpnHash , AbsoluteBytePos > ,
468468 foreign_expn_data : & ' a UnhashMap < ExpnHash , u32 > ,
469469 hygiene_context : & ' a HygieneDecodeContext ,
@@ -584,13 +584,12 @@ impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>> for Vec<u8> {
584584
585585impl < ' a , ' tcx > SpanDecoder for CacheDecoder < ' a , ' tcx > {
586586 fn decode_syntax_context ( & mut self ) -> SyntaxContext {
587- let syntax_contexts = self . syntax_contexts ;
588587 rustc_span:: hygiene:: decode_syntax_context ( self , self . hygiene_context , |this, id| {
589588 // This closure is invoked if we haven't already decoded the data for the `SyntaxContext` we are deserializing.
590589 // 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 ( ) ;
592591 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 ) ;
594593 data
595594 } )
596595 } )
0 commit comments