Switch to home-made db attaching infrastructure

Instead of using Salsa's, as we can no longer can a `dyn HirDatabase` from the `dyn salsa::Database` Salsa provides.
This commit is contained in:
Chayim Refael Friedman 2025-10-05 09:55:50 +03:00
parent a7234f8b3a
commit c6ef51e550
52 changed files with 499 additions and 418 deletions

View file

@ -134,7 +134,7 @@ fn library_symbols(db: &dyn SymbolsDatabase, source_root_id: SourceRootId) -> Ar
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, || {
hir::attach_db(db, || {
let mut symbol_collector = SymbolCollector::new(db);
db.source_root_crates(source_root_id)
@ -153,7 +153,7 @@ fn module_symbols(db: &dyn SymbolsDatabase, module: Module) -> Arc<SymbolIndex>
let _p = tracing::info_span!("module_symbols").entered();
// 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))))
hir::attach_db(db, || Arc::new(SymbolIndex::new(SymbolCollector::new_module(db, module))))
}
pub fn crate_symbols(db: &dyn SymbolsDatabase, krate: Crate) -> Box<[Arc<SymbolIndex>]> {

View file

@ -473,7 +473,7 @@ mod tests {
frange.range,
"selection is not an expression(yet contained in one)"
);
let name = salsa::attach(sema.db, || NameGenerator::default().for_variable(&expr, &sema));
let name = hir::attach_db(sema.db, || NameGenerator::default().for_variable(&expr, &sema));
assert_eq!(&name, expected);
}