@@ -23,16 +23,16 @@ use std::mem;
23
23
use syntax:: ast:: NodeId ;
24
24
use syntax:: source_map:: { SourceMap , StableSourceFileId } ;
25
25
use syntax_pos:: { BytePos , Span , DUMMY_SP , SourceFile } ;
26
- use syntax_pos:: hygiene:: { ExpnId , SyntaxContext , ExpnInfo } ;
26
+ use syntax_pos:: hygiene:: { ExpnId , SyntaxContext , ExpnData } ;
27
27
28
28
const TAG_FILE_FOOTER : u128 = 0xC0FFEE_C0FFEE_C0FFEE_C0FFEE_C0FFEE ;
29
29
30
30
const TAG_CLEAR_CROSS_CRATE_CLEAR : u8 = 0 ;
31
31
const TAG_CLEAR_CROSS_CRATE_SET : u8 = 1 ;
32
32
33
- const TAG_NO_EXPANSION_INFO : u8 = 0 ;
34
- const TAG_EXPANSION_INFO_SHORTHAND : u8 = 1 ;
35
- const TAG_EXPANSION_INFO_INLINE : u8 = 2 ;
33
+ const TAG_NO_EXPN_DATA : u8 = 0 ;
34
+ const TAG_EXPN_DATA_SHORTHAND : u8 = 1 ;
35
+ const TAG_EXPN_DATA_INLINE : u8 = 2 ;
36
36
37
37
const TAG_VALID_SPAN : u8 = 0 ;
38
38
const TAG_INVALID_SPAN : u8 = 1 ;
@@ -58,7 +58,7 @@ pub struct OnDiskCache<'sess> {
58
58
59
59
// These two fields caches that are populated lazily during decoding.
60
60
file_index_to_file : Lock < FxHashMap < SourceFileIndex , Lrc < SourceFile > > > ,
61
- synthetic_expansion_infos : Lock < FxHashMap < AbsoluteBytePos , SyntaxContext > > ,
61
+ synthetic_syntax_contexts : Lock < FxHashMap < AbsoluteBytePos , SyntaxContext > > ,
62
62
63
63
// A map from dep-node to the position of the cached query result in
64
64
// `serialized_data`.
@@ -135,7 +135,7 @@ impl<'sess> OnDiskCache<'sess> {
135
135
current_diagnostics : Default :: default ( ) ,
136
136
query_result_index : footer. query_result_index . into_iter ( ) . collect ( ) ,
137
137
prev_diagnostics_index : footer. diagnostics_index . into_iter ( ) . collect ( ) ,
138
- synthetic_expansion_infos : Default :: default ( ) ,
138
+ synthetic_syntax_contexts : Default :: default ( ) ,
139
139
alloc_decoding_state : AllocDecodingState :: new ( footer. interpret_alloc_index ) ,
140
140
}
141
141
}
@@ -151,7 +151,7 @@ impl<'sess> OnDiskCache<'sess> {
151
151
current_diagnostics : Default :: default ( ) ,
152
152
query_result_index : Default :: default ( ) ,
153
153
prev_diagnostics_index : Default :: default ( ) ,
154
- synthetic_expansion_infos : Default :: default ( ) ,
154
+ synthetic_syntax_contexts : Default :: default ( ) ,
155
155
alloc_decoding_state : AllocDecodingState :: new ( Vec :: new ( ) ) ,
156
156
}
157
157
}
@@ -185,7 +185,7 @@ impl<'sess> OnDiskCache<'sess> {
185
185
encoder,
186
186
type_shorthands : Default :: default ( ) ,
187
187
predicate_shorthands : Default :: default ( ) ,
188
- expn_info_shorthands : Default :: default ( ) ,
188
+ expn_data_shorthands : Default :: default ( ) ,
189
189
interpret_allocs : Default :: default ( ) ,
190
190
interpret_allocs_inverse : Vec :: new ( ) ,
191
191
source_map : CachingSourceMapView :: new ( tcx. sess . source_map ( ) ) ,
@@ -383,7 +383,7 @@ impl<'sess> OnDiskCache<'sess> {
383
383
cnum_map : self . cnum_map . get ( ) ,
384
384
file_index_to_file : & self . file_index_to_file ,
385
385
file_index_to_stable_id : & self . file_index_to_stable_id ,
386
- synthetic_expansion_infos : & self . synthetic_expansion_infos ,
386
+ synthetic_syntax_contexts : & self . synthetic_syntax_contexts ,
387
387
alloc_decoding_session : self . alloc_decoding_state . new_decoding_session ( ) ,
388
388
} ;
389
389
@@ -440,7 +440,7 @@ struct CacheDecoder<'a, 'tcx> {
440
440
opaque : opaque:: Decoder < ' a > ,
441
441
source_map : & ' a SourceMap ,
442
442
cnum_map : & ' a IndexVec < CrateNum , Option < CrateNum > > ,
443
- synthetic_expansion_infos : & ' a Lock < FxHashMap < AbsoluteBytePos , SyntaxContext > > ,
443
+ synthetic_syntax_contexts : & ' a Lock < FxHashMap < AbsoluteBytePos , SyntaxContext > > ,
444
444
file_index_to_file : & ' a Lock < FxHashMap < SourceFileIndex , Lrc < SourceFile > > > ,
445
445
file_index_to_stable_id : & ' a FxHashMap < SourceFileIndex , StableSourceFileId > ,
446
446
alloc_decoding_session : AllocDecodingSession < ' a > ,
@@ -586,37 +586,37 @@ impl<'a, 'tcx> SpecializedDecoder<Span> for CacheDecoder<'a, 'tcx> {
586
586
let lo = file_lo. lines [ line_lo - 1 ] + col_lo;
587
587
let hi = lo + len;
588
588
589
- let expn_info_tag = u8:: decode ( self ) ?;
589
+ let expn_data_tag = u8:: decode ( self ) ?;
590
590
591
- // FIXME(mw): This method does not restore `ExpnInfo ::parent` or
591
+ // FIXME(mw): This method does not restore `ExpnData ::parent` or
592
592
// `SyntaxContextData::prev_ctxt` or `SyntaxContextData::opaque`. These things
593
593
// don't seem to be used after HIR lowering, so everything should be fine
594
594
// as long as incremental compilation does not kick in before that.
595
595
let location = || Span :: with_root_ctxt ( lo, hi) ;
596
- let recover_from_expn_info = |this : & Self , expn_info , pos| {
597
- let span = location ( ) . fresh_expansion ( expn_info ) ;
598
- this. synthetic_expansion_infos . borrow_mut ( ) . insert ( pos, span. ctxt ( ) ) ;
596
+ let recover_from_expn_data = |this : & Self , expn_data , pos| {
597
+ let span = location ( ) . fresh_expansion ( expn_data ) ;
598
+ this. synthetic_syntax_contexts . borrow_mut ( ) . insert ( pos, span. ctxt ( ) ) ;
599
599
span
600
600
} ;
601
- Ok ( match expn_info_tag {
602
- TAG_NO_EXPANSION_INFO => {
601
+ Ok ( match expn_data_tag {
602
+ TAG_NO_EXPN_DATA => {
603
603
location ( )
604
604
}
605
- TAG_EXPANSION_INFO_INLINE => {
606
- let expn_info = Decodable :: decode ( self ) ?;
607
- recover_from_expn_info (
608
- self , expn_info , AbsoluteBytePos :: new ( self . opaque . position ( ) )
605
+ TAG_EXPN_DATA_INLINE => {
606
+ let expn_data = Decodable :: decode ( self ) ?;
607
+ recover_from_expn_data (
608
+ self , expn_data , AbsoluteBytePos :: new ( self . opaque . position ( ) )
609
609
)
610
610
}
611
- TAG_EXPANSION_INFO_SHORTHAND => {
611
+ TAG_EXPN_DATA_SHORTHAND => {
612
612
let pos = AbsoluteBytePos :: decode ( self ) ?;
613
- let cached_ctxt = self . synthetic_expansion_infos . borrow ( ) . get ( & pos) . cloned ( ) ;
613
+ let cached_ctxt = self . synthetic_syntax_contexts . borrow ( ) . get ( & pos) . cloned ( ) ;
614
614
if let Some ( ctxt) = cached_ctxt {
615
615
Span :: new ( lo, hi, ctxt)
616
616
} else {
617
- let expn_info =
618
- self . with_position ( pos. to_usize ( ) , |this| ExpnInfo :: decode ( this) ) ?;
619
- recover_from_expn_info ( self , expn_info , pos)
617
+ let expn_data =
618
+ self . with_position ( pos. to_usize ( ) , |this| ExpnData :: decode ( this) ) ?;
619
+ recover_from_expn_data ( self , expn_data , pos)
620
620
}
621
621
}
622
622
_ => {
@@ -725,7 +725,7 @@ struct CacheEncoder<'a, 'tcx, E: ty_codec::TyEncoder> {
725
725
encoder : & ' a mut E ,
726
726
type_shorthands : FxHashMap < Ty < ' tcx > , usize > ,
727
727
predicate_shorthands : FxHashMap < ty:: Predicate < ' tcx > , usize > ,
728
- expn_info_shorthands : FxHashMap < ExpnId , AbsoluteBytePos > ,
728
+ expn_data_shorthands : FxHashMap < ExpnId , AbsoluteBytePos > ,
729
729
interpret_allocs : FxHashMap < interpret:: AllocId , usize > ,
730
730
interpret_allocs_inverse : Vec < interpret:: AllocId > ,
731
731
source_map : CachingSourceMapView < ' tcx > ,
@@ -817,17 +817,17 @@ where
817
817
len. encode ( self ) ?;
818
818
819
819
if span_data. ctxt == SyntaxContext :: root ( ) {
820
- TAG_NO_EXPANSION_INFO . encode ( self )
820
+ TAG_NO_EXPN_DATA . encode ( self )
821
821
} else {
822
- let ( expn_id, expn_info ) = span_data. ctxt . outer_expn_with_info ( ) ;
823
- if let Some ( pos) = self . expn_info_shorthands . get ( & expn_id) . cloned ( ) {
824
- TAG_EXPANSION_INFO_SHORTHAND . encode ( self ) ?;
822
+ let ( expn_id, expn_data ) = span_data. ctxt . outer_expn_with_data ( ) ;
823
+ if let Some ( pos) = self . expn_data_shorthands . get ( & expn_id) . cloned ( ) {
824
+ TAG_EXPN_DATA_SHORTHAND . encode ( self ) ?;
825
825
pos. encode ( self )
826
826
} else {
827
- TAG_EXPANSION_INFO_INLINE . encode ( self ) ?;
827
+ TAG_EXPN_DATA_INLINE . encode ( self ) ?;
828
828
let pos = AbsoluteBytePos :: new ( self . position ( ) ) ;
829
- self . expn_info_shorthands . insert ( expn_id, pos) ;
830
- expn_info . encode ( self )
829
+ self . expn_data_shorthands . insert ( expn_id, pos) ;
830
+ expn_data . encode ( self )
831
831
}
832
832
}
833
833
}
0 commit comments