Merge pull request #20497 from ChayimFriedman2/symbols-attach2

Attach the DB when mapping the result of `world_symbols()`
This commit is contained in:
Chayim Refael Friedman 2025-08-21 05:25:40 +00:00 committed by GitHub
commit a161fd6bc1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -481,12 +481,15 @@ impl Analysis {
// `world_symbols` currently clones the database to run stuff in parallel, which will make any query panic
// if we were to attach it here.
Cancelled::catch(|| {
symbol_index::world_symbols(&self.db, query)
.into_iter()
.filter_map(|s| s.try_to_nav(&self.db))
.take(limit)
.map(UpmappingResult::call_site)
.collect::<Vec<_>>()
let symbols = symbol_index::world_symbols(&self.db, query);
salsa::attach(&self.db, || {
symbols
.into_iter()
.filter_map(|s| s.try_to_nav(&self.db))
.take(limit)
.map(UpmappingResult::call_site)
.collect::<Vec<_>>()
})
})
}