Skip to main content

file_definitions

Function file_definitions 

Source
pub fn file_definitions<'db>(
    db: &'db dyn Database,
    file: SourceFile,
) -> SliceArc
Expand description

Collect Pass-1 definitions (classes, interfaces, traits, enums, functions, constants, global_vars) from a file. Uses mir-analyzer’s collector in its new pure-slice mode (collect_slice), added in mir 0.7.1 for salsa integration.

Phase K2: when the cached_slice input field is Some, returns that slice directly and skips parse + DefinitionCollector. The slice is seeded before any query runs (by the workspace-scan warm-start path) and cleared on every text edit in DocumentStore::mirror_text, so by construction a cached slice is equivalent to what parse+collect would produce for the file’s current text. Reading file.text(db) on the cached path is still required: it declares a salsa dependency on the text input so that a future edit invalidates this query’s memo and forces a recompute via the fresh-parse branch.