File tree 2 files changed +4
-5
lines changed
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
83
83
fn file_item_tree ( & self , file_id : HirFileId ) -> Arc < ItemTree > ;
84
84
85
85
#[ 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]
89
86
fn block_item_tree_query ( & self , block_id : BlockId ) -> Arc < ItemTree > ;
90
87
91
88
#[ salsa:: invoke( crate_def_map_wait) ]
Original file line number Diff line number Diff line change @@ -148,7 +148,9 @@ impl ItemTree {
148
148
let block = loc. ast_id . to_node ( db. upcast ( ) ) ;
149
149
150
150
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)
152
154
}
153
155
154
156
/// Returns an iterator over all items located at the top level of the `HirFileId` this
@@ -383,7 +385,7 @@ impl TreeId {
383
385
384
386
pub ( crate ) fn item_tree ( & self , db : & dyn DefDatabase ) -> Arc < ItemTree > {
385
387
match self . block {
386
- Some ( block) => ItemTree :: block_item_tree_query ( db , block) ,
388
+ Some ( block) => db . block_item_tree_query ( block) ,
387
389
None => db. file_item_tree ( self . file ) ,
388
390
}
389
391
}
You can’t perform that action at this time.
0 commit comments