File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -83,9 +83,6 @@ pub trait DefDatabase: InternDatabase + ExpandDatabase + Upcast<dyn ExpandDataba
8383 fn file_item_tree ( & self , file_id : HirFileId ) -> Arc < ItemTree > ;
8484
8585 #[ salsa:: invoke( ItemTree :: block_item_tree_query) ]
86- // FIXME: Investigate memory usage increase if this were not transparent
87- // Also make sure to `shrink_to_fit` if you do
88- #[ salsa:: transparent]
8986 fn block_item_tree_query ( & self , block_id : BlockId ) -> Arc < ItemTree > ;
9087
9188 #[ salsa:: invoke( crate_def_map_wait) ]
Original file line number Diff line number Diff line change @@ -148,7 +148,9 @@ impl ItemTree {
148148 let block = loc. ast_id . to_node ( db. upcast ( ) ) ;
149149
150150 let ctx = lower:: Ctx :: new ( db, loc. ast_id . file_id ) ;
151- Arc :: new ( ctx. lower_block ( & block) )
151+ let mut item_tree = ctx. lower_block ( & block) ;
152+ item_tree. shrink_to_fit ( ) ;
153+ Arc :: new ( item_tree)
152154 }
153155
154156 /// Returns an iterator over all items located at the top level of the `HirFileId` this
@@ -383,7 +385,7 @@ impl TreeId {
383385
384386 pub ( crate ) fn item_tree ( & self , db : & dyn DefDatabase ) -> Arc < ItemTree > {
385387 match self . block {
386- Some ( block) => ItemTree :: block_item_tree_query ( db , block) ,
388+ Some ( block) => db . block_item_tree_query ( block) ,
387389 None => db. file_item_tree ( self . file ) ,
388390 }
389391 }
You can’t perform that action at this time.
0 commit comments