Skip to content

Commit

Permalink
Auto merge of rust-lang#14587 - Veykril:macro-def-err, r=Veykril
Browse files Browse the repository at this point in the history
fix: Bring back LRU limit for macro_expand query

Should fix the memory increase
  • Loading branch information
bors committed Apr 16, 2023
2 parents 924d30a + 76718ea commit 9b54e39
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 0 additions & 2 deletions crates/hir-def/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ pub trait DefDatabase: InternDatabase + ExpandDatabase + Upcast<dyn ExpandDataba
///
/// The `block_def_map` for block 0 would return `None`, while `block_def_map` of block 1 would
/// return a `DefMap` containing `inner`.
// FIXME: This actually can't return None anymore as we no longer allocate block scopes for
// non item declaring blocks
#[salsa::invoke(DefMap::block_def_map_query)]
fn block_def_map(&self, block: BlockId) -> Arc<DefMap>;

Expand Down
6 changes: 6 additions & 0 deletions crates/ide-db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ impl RootDatabase {
.copied()
.unwrap_or(base_db::DEFAULT_LRU_CAP),
);
hir_db::MacroExpandQuery.in_db_mut(self).set_lru_capacity(
lru_capacities
.get(stringify!(MacroExpandQuery))
.copied()
.unwrap_or(base_db::DEFAULT_LRU_CAP),
);

macro_rules! update_lru_capacity_per_query {
($( $module:ident :: $query:ident )*) => {$(
Expand Down

0 comments on commit 9b54e39

Please sign in to comment.