@@ -5,21 +5,18 @@ mod lower;
55mod tests;
66pub mod scope;
77
8- use std:: { mem , ops:: Index , sync:: Arc } ;
8+ use std:: { ops:: Index , sync:: Arc } ;
99
1010use base_db:: CrateId ;
1111use cfg:: { CfgExpr , CfgOptions } ;
1212use drop_bomb:: DropBomb ;
1313use either:: Either ;
14- use hir_expand:: {
15- ast_id_map:: AstIdMap , hygiene:: Hygiene , AstId , ExpandError , ExpandResult , HirFileId , InFile ,
16- MacroCallId ,
17- } ;
14+ use hir_expand:: { hygiene:: Hygiene , ExpandError , ExpandResult , HirFileId , InFile , MacroCallId } ;
1815use la_arena:: { Arena , ArenaMap } ;
1916use limit:: Limit ;
2017use profile:: Count ;
2118use rustc_hash:: FxHashMap ;
22- use syntax:: { ast, AstNode , AstPtr , SyntaxNodePtr } ;
19+ use syntax:: { ast, AstPtr , SyntaxNodePtr } ;
2320
2421use crate :: {
2522 attr:: { Attrs , RawAttrs } ,
@@ -50,7 +47,6 @@ pub struct Expander {
5047 cfg_expander : CfgExpander ,
5148 def_map : Arc < DefMap > ,
5249 current_file_id : HirFileId ,
53- ast_id_map : Option < Arc < AstIdMap > > ,
5450 module : LocalModuleId ,
5551 recursion_limit : usize ,
5652}
@@ -84,7 +80,6 @@ impl Expander {
8480 cfg_expander,
8581 def_map,
8682 current_file_id,
87- ast_id_map : None ,
8883 module : module. local_id ,
8984 recursion_limit : 0 ,
9085 }
@@ -167,22 +162,17 @@ impl Expander {
167162 tracing:: debug!( "macro expansion {:#?}" , node. syntax( ) ) ;
168163
169164 self . recursion_limit += 1 ;
170- let mark = Mark {
171- file_id : self . current_file_id ,
172- ast_id_map : mem:: take ( & mut self . ast_id_map ) ,
173- bomb : DropBomb :: new ( "expansion mark dropped" ) ,
174- } ;
165+ let mark =
166+ Mark { file_id : self . current_file_id , bomb : DropBomb :: new ( "expansion mark dropped" ) } ;
175167 self . cfg_expander . hygiene = Hygiene :: new ( db. upcast ( ) , file_id) ;
176168 self . current_file_id = file_id;
177- self . ast_id_map = None ;
178169
179170 ExpandResult { value : Some ( ( mark, node) ) , err }
180171 }
181172
182173 pub fn exit ( & mut self , db : & dyn DefDatabase , mut mark : Mark ) {
183174 self . cfg_expander . hygiene = Hygiene :: new ( db. upcast ( ) , mark. file_id ) ;
184175 self . current_file_id = mark. file_id ;
185- self . ast_id_map = mem:: take ( & mut mark. ast_id_map ) ;
186176 self . recursion_limit -= 1 ;
187177 mark. bomb . defuse ( ) ;
188178 }
@@ -212,12 +202,6 @@ impl Expander {
212202 self . def_map . resolve_path ( db, self . module , path, BuiltinShadowMode :: Other ) . 0 . take_macros ( )
213203 }
214204
215- fn ast_id < N : AstNode > ( & mut self , db : & dyn DefDatabase , item : & N ) -> AstId < N > {
216- let file_local_id =
217- self . ast_id_map . get_or_insert_with ( || db. ast_id_map ( self . current_file_id ) ) . ast_id ( item) ;
218- AstId :: new ( self . current_file_id , file_local_id)
219- }
220-
221205 fn recursion_limit ( & self , db : & dyn DefDatabase ) -> Limit {
222206 let limit = db. crate_limits ( self . cfg_expander . krate ) . recursion_limit as _ ;
223207
@@ -233,7 +217,6 @@ impl Expander {
233217#[ derive( Debug ) ]
234218pub struct Mark {
235219 file_id : HirFileId ,
236- ast_id_map : Option < Arc < AstIdMap > > ,
237220 bomb : DropBomb ,
238221}
239222
0 commit comments