@@ -31,7 +31,7 @@ use rustc_session::config::CrateType;
3131use rustc_span:: symbol:: { sym, Ident , Symbol } ;
3232use rustc_span:: { self , ExternalSource , FileName , SourceFile , Span , SyntaxContext } ;
3333use rustc_span:: {
34- hygiene:: { HygieneEncodeContext , MacroKind } ,
34+ hygiene:: { ExpnIndex , HygieneEncodeContext , MacroKind } ,
3535 RealFileName ,
3636} ;
3737use rustc_target:: abi:: VariantIdx ;
@@ -168,6 +168,12 @@ impl<'a, 'tcx> Encodable<EncodeContext<'a, 'tcx>> for DefIndex {
168168 }
169169}
170170
171+ impl < ' a , ' tcx > Encodable < EncodeContext < ' a , ' tcx > > for ExpnIndex {
172+ fn encode ( & self , s : & mut EncodeContext < ' a , ' tcx > ) -> opaque:: EncodeResult {
173+ s. emit_u32 ( self . as_u32 ( ) )
174+ }
175+ }
176+
171177impl < ' a , ' tcx > Encodable < EncodeContext < ' a , ' tcx > > for SyntaxContext {
172178 fn encode ( & self , s : & mut EncodeContext < ' a , ' tcx > ) -> opaque:: EncodeResult {
173179 rustc_span:: hygiene:: raw_encode_syntax_context ( * self , & s. hygiene_ctxt , s)
@@ -1588,8 +1594,10 @@ impl EncodeContext<'a, 'tcx> {
15881594 Ok ( ( ) )
15891595 } ,
15901596 |( this, _, expn_data_table, expn_hash_table) , index, expn_data, hash| {
1591- expn_data_table. set ( index, this. lazy ( expn_data) ) ;
1592- expn_hash_table. set ( index, this. lazy ( hash) ) ;
1597+ if let Some ( index) = index. as_local ( ) {
1598+ expn_data_table. set ( index. as_raw ( ) , this. lazy ( expn_data) ) ;
1599+ expn_hash_table. set ( index. as_raw ( ) , this. lazy ( hash) ) ;
1600+ }
15931601 Ok ( ( ) )
15941602 } ,
15951603 ) ;
0 commit comments