@@ -16,7 +16,7 @@ use rustc_serialize::opaque::{FileEncodeResult, FileEncoder, IntEncodedWithFixed
1616use rustc_serialize:: { Decodable , Decoder , Encodable , Encoder } ;
1717use rustc_session:: Session ;
1818use rustc_span:: hygiene:: {
19- ExpnId , HygieneDecodeContext , HygieneEncodeContext , SyntaxContext , SyntaxContextData ,
19+ ExpnId , HygieneDecodeContext , HygieneEncodeContext , SyntaxContext , SyntaxContextKey ,
2020} ;
2121use rustc_span:: source_map:: Spanned ;
2222use rustc_span:: {
@@ -39,7 +39,7 @@ const TAG_FULL_SPAN: u8 = 0;
3939const TAG_PARTIAL_SPAN : u8 = 1 ;
4040const TAG_RELATIVE_SPAN : u8 = 2 ;
4141
42- const TAG_SYNTAX_CONTEXT : u8 = 0 ;
42+ const TAG_SYNTAX_CONTEXT_KEY : u8 = 0 ;
4343const TAG_EXPN_DATA : u8 = 1 ;
4444
4545// Tags for encoding Symbol's
@@ -79,7 +79,7 @@ pub struct OnDiskCache {
7979 // to represent the fact that we are storing *encoded* ids. When we decode
8080 // a `SyntaxContext`, a new id will be allocated from the global `HygieneData`,
8181 // which will almost certainly be different than the serialized id.
82- syntax_contexts : FxHashMap < u32 , AbsoluteBytePos > ,
82+ syntax_context_keys : FxHashMap < u32 , AbsoluteBytePos > ,
8383 // A map from the `DefPathHash` of an `ExpnId` to the position
8484 // of their associated `ExpnData`. Ideally, we would store a `DefId`,
8585 // but we need to decode this before we've constructed a `TyCtxt` (which
@@ -110,7 +110,7 @@ struct Footer {
110110 // without measurable overhead. This permits larger const allocations without ICEing.
111111 interpret_alloc_index : Vec < u64 > ,
112112 // See `OnDiskCache.syntax_contexts`
113- syntax_contexts : FxHashMap < u32 , AbsoluteBytePos > ,
113+ syntax_context_keys : FxHashMap < u32 , AbsoluteBytePos > ,
114114 // See `OnDiskCache.expn_data`
115115 expn_data : UnhashMap < ExpnHash , AbsoluteBytePos > ,
116116 foreign_expn_data : UnhashMap < ExpnHash , u32 > ,
@@ -180,7 +180,7 @@ impl OnDiskCache {
180180 query_result_index : footer. query_result_index . into_iter ( ) . collect ( ) ,
181181 prev_side_effects_index : footer. side_effects_index . into_iter ( ) . collect ( ) ,
182182 alloc_decoding_state : AllocDecodingState :: new ( footer. interpret_alloc_index ) ,
183- syntax_contexts : footer. syntax_contexts ,
183+ syntax_context_keys : footer. syntax_context_keys ,
184184 expn_data : footer. expn_data ,
185185 foreign_expn_data : footer. foreign_expn_data ,
186186 hygiene_context : Default :: default ( ) ,
@@ -196,7 +196,7 @@ impl OnDiskCache {
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 OnDiskCache {
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 OnDiskCache {
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 OnDiskCache {
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 } ,
@@ -425,7 +425,7 @@ impl OnDiskCache {
425425 file_index_to_file : & self . file_index_to_file ,
426426 file_index_to_stable_id : & self . file_index_to_stable_id ,
427427 alloc_decoding_session : self . alloc_decoding_state . new_decoding_session ( ) ,
428- syntax_contexts : & self . syntax_contexts ,
428+ syntax_context_keys : & self . syntax_context_keys ,
429429 expn_data : & self . expn_data ,
430430 foreign_expn_data : & self . foreign_expn_data ,
431431 hygiene_context : & self . hygiene_context ,
@@ -445,7 +445,7 @@ pub struct CacheDecoder<'a, 'tcx> {
445445 file_index_to_file : & ' a Lock < FxHashMap < SourceFileIndex , Arc < SourceFile > > > ,
446446 file_index_to_stable_id : & ' a FxHashMap < SourceFileIndex , EncodedSourceFileId > ,
447447 alloc_decoding_session : AllocDecodingSession < ' a > ,
448- syntax_contexts : & ' a FxHashMap < u32 , AbsoluteBytePos > ,
448+ syntax_context_keys : & ' a FxHashMap < u32 , AbsoluteBytePos > ,
449449 expn_data : & ' a UnhashMap < ExpnHash , AbsoluteBytePos > ,
450450 foreign_expn_data : & ' a UnhashMap < ExpnHash , u32 > ,
451451 hygiene_context : & ' a HygieneDecodeContext ,
@@ -560,13 +560,12 @@ impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>> for Vec<u8> {
560560
561561impl < ' a , ' tcx > SpanDecoder for CacheDecoder < ' a , ' tcx > {
562562 fn decode_syntax_context ( & mut self ) -> SyntaxContext {
563- let syntax_contexts = self . syntax_contexts ;
564563 rustc_span:: hygiene:: decode_syntax_context ( self , self . hygiene_context , |this, id| {
565564 // This closure is invoked if we haven't already decoded the data for the `SyntaxContext` we are deserializing.
566565 // We look up the position of the associated `SyntaxData` and decode it.
567- let pos = syntax_contexts . get ( & id) . unwrap ( ) ;
566+ let pos = this . syntax_context_keys . get ( & id) . unwrap ( ) ;
568567 this. with_position ( pos. to_usize ( ) , |decoder| {
569- let data: SyntaxContextData = decode_tagged ( decoder, TAG_SYNTAX_CONTEXT ) ;
568+ let data: SyntaxContextKey = decode_tagged ( decoder, TAG_SYNTAX_CONTEXT_KEY ) ;
570569 data
571570 } )
572571 } )
0 commit comments