Auto merge of #14587 - Veykril:macro-def-err, r=Veykril

fix: Bring back LRU limit for macro_expand query

Should fix the memory increase
This commit is contained in:
bors 2023-04-16 19:30:42 +00:00
commit 9b54e39762
2 changed files with 6 additions and 2 deletions

View File

@ -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 /// The `block_def_map` for block 0 would return `None`, while `block_def_map` of block 1 would
/// return a `DefMap` containing `inner`. /// 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)] #[salsa::invoke(DefMap::block_def_map_query)]
fn block_def_map(&self, block: BlockId) -> Arc<DefMap>; fn block_def_map(&self, block: BlockId) -> Arc<DefMap>;

View File

@ -166,6 +166,12 @@ pub fn update_lru_capacities(&mut self, lru_capacities: &FxHashMap<Box<str>, usi
.copied() .copied()
.unwrap_or(base_db::DEFAULT_LRU_CAP), .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 { macro_rules! update_lru_capacity_per_query {
($( $module:ident :: $query:ident )*) => {$( ($( $module:ident :: $query:ident )*) => {$(