mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-02 21:04:18 +00:00
Attach the DB in symbol queries
This commit is contained in:
parent
f9e402dfcb
commit
243d158e88
1 changed files with 14 additions and 10 deletions
|
|
@ -133,6 +133,8 @@ pub trait SymbolsDatabase: HirDatabase + SourceDatabase {
|
|||
fn library_symbols(db: &dyn SymbolsDatabase, source_root_id: SourceRootId) -> Arc<SymbolIndex> {
|
||||
let _p = tracing::info_span!("library_symbols").entered();
|
||||
|
||||
// We call this without attaching because this runs in parallel, so we need to attach here.
|
||||
salsa::attach(db, || {
|
||||
let mut symbol_collector = SymbolCollector::new(db);
|
||||
|
||||
db.source_root_crates(source_root_id)
|
||||
|
|
@ -144,12 +146,14 @@ fn library_symbols(db: &dyn SymbolsDatabase, source_root_id: SourceRootId) -> Ar
|
|||
.for_each(|module| symbol_collector.collect(module));
|
||||
|
||||
Arc::new(SymbolIndex::new(symbol_collector.finish()))
|
||||
})
|
||||
}
|
||||
|
||||
fn module_symbols(db: &dyn SymbolsDatabase, module: Module) -> Arc<SymbolIndex> {
|
||||
let _p = tracing::info_span!("module_symbols").entered();
|
||||
|
||||
Arc::new(SymbolIndex::new(SymbolCollector::new_module(db, module)))
|
||||
// We call this without attaching because this runs in parallel, so we need to attach here.
|
||||
salsa::attach(db, || Arc::new(SymbolIndex::new(SymbolCollector::new_module(db, module))))
|
||||
}
|
||||
|
||||
pub fn crate_symbols(db: &dyn SymbolsDatabase, krate: Crate) -> Box<[Arc<SymbolIndex>]> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue