@@ -132,9 +132,6 @@ pub struct SemanticsImpl<'db> {
132132 s2d_cache : RefCell < SourceToDefCache > ,
133133 /// Rootnode to HirFileId cache
134134 root_to_file_cache : RefCell < FxHashMap < SyntaxNode , HirFileId > > ,
135- /// HirFileId to Rootnode cache (this adds a layer over the database LRU cache to prevent
136- /// possibly frequent invalidation)
137- parse_cache : RefCell < FxHashMap < HirFileId , SyntaxNode > > ,
138135 /// MacroCall to its expansion's MacroFileId cache
139136 macro_call_cache : RefCell < FxHashMap < InFile < ast:: MacroCall > , MacroFileId > > ,
140137}
@@ -295,7 +292,6 @@ impl<'db> SemanticsImpl<'db> {
295292 db,
296293 s2d_cache : Default :: default ( ) ,
297294 root_to_file_cache : Default :: default ( ) ,
298- parse_cache : Default :: default ( ) ,
299295 macro_call_cache : Default :: default ( ) ,
300296 }
301297 }
@@ -307,9 +303,6 @@ impl<'db> SemanticsImpl<'db> {
307303 }
308304
309305 pub fn parse_or_expand ( & self , file_id : HirFileId ) -> SyntaxNode {
310- if let Some ( root) = self . parse_cache . borrow ( ) . get ( & file_id) {
311- return root. clone ( ) ;
312- }
313306 let node = self . db . parse_or_expand ( file_id) ;
314307 self . cache ( node. clone ( ) , file_id) ;
315308 node
@@ -1490,9 +1483,8 @@ impl<'db> SemanticsImpl<'db> {
14901483 fn cache ( & self , root_node : SyntaxNode , file_id : HirFileId ) {
14911484 assert ! ( root_node. parent( ) . is_none( ) ) ;
14921485 let mut cache = self . root_to_file_cache . borrow_mut ( ) ;
1493- let prev = cache. insert ( root_node. clone ( ) , file_id) ;
1486+ let prev = cache. insert ( root_node, file_id) ;
14941487 assert ! ( prev. is_none( ) || prev == Some ( file_id) ) ;
1495- self . parse_cache . borrow_mut ( ) . insert ( file_id, root_node) ;
14961488 }
14971489
14981490 pub fn assert_contains_node ( & self , node : & SyntaxNode ) {
0 commit comments