Skip to main content

file_check_digest

Function file_check_digest 

Source
pub fn file_check_digest(
    name: &str,
    kind: UnitKind,
    pf: &ParsedFile,
    unit_files_digest: u64,
    unit_info: &BTreeMap<String, UnitInfo>,
    combined_types: &HashMap<String, Arc<TypeDecl>>,
    combined_fns: &HashMap<String, Arc<FnDecl>>,
    combined_methods: &HashMap<String, MethodTable>,
    local_names: &HashSet<String>,
    local_methods_for_type: &HashMap<String, Vec<FnDecl>>,
    consumed_types: &HashMap<String, ConsumedType>,
    imported_from: &HashMap<String, String>,
    ctx: &UnitCheckCtx,
    decls: &mut DeclDigests,
) -> u64
Expand description

#3243 S2.3b: a digest of everything check_file_core reads, so a file’s checked output can be kept from one language-server round to the next and replayed when this value is unchanged.

It is a content hash (rendered Debug, which includes every span and FileId), not a pointer: the parse cache hands out freshly built decls each round, so identity does not survive. Span-inclusive on purpose: a diagnostic may carry a label that points into another file at an offset, and an upstream edit that moves a declaration moves that offset.

The unit’s own table is not rendered: phase_symbol_tables builds it from the unit’s own files, whose text is hashed (unit_files_digest), so only the parts filled in from other units are taken (UnitTable::cross_unit_facts).

Adding an input to check_file_core or to UnitCheckCtx means adding it here. UnitCheckCtx and UnitTable are destructured exhaustively, so a new field of either is a compile error until it is classified; check_file_core’s own parameters are the same list as this function’s.