Skip to main content

Module db

Module db 

Source
Expand description

Salsa-based incremental computation layer.

After the mir-analyzer 0.22 migration, semantic analysis (Pass 2, class issues, references) is owned by AnalysisSession in DocumentStore. Salsa here is now responsible for the LSP-side compact representations only: parsed AST cache (parse), per-file declaration index (index), workspace aggregation (workspace_index). These power cross-file LSP features (workspace symbols, document symbols, find-implementations, hover from index) that don’t require the analyzer’s full type system.

Re-exports§

pub use input::FileText;
pub use input::SourceFile;
pub use input::Workspace;
pub use input::find_source_file;
pub use input::workspace_files;

Modules§

analysis
Database + AnalysisHost split (rust-analyzer pattern).
index
file_index salsa query — derives a compact FileIndex from a parsed document. Depends on parsed_doc, so editing a file reparses once and the index re-extracts from the new AST.
input
Salsa inputs.
parse
The parsed_doc salsa query: parses a SourceFile into an Arc<ParsedDoc> under salsa memoization. Downstream queries (file_index, symbol_map, semantic diagnostics) depend on this one, so each file is parsed at most once per revision.
symbol_map
symbol_map salsa query — derives a SymbolMap from a parsed document.
workspace_index
workspace_index salsa query — aggregates every file’s FileIndex into a single structure with pre-built reverse maps.