pub fn effects_assertion_diagnostics(
file: FileId,
hir: &HirFile,
index: &SymbolIndex,
scope: &ImportScope,
rows: &BTreeMap<DefinitionId, EffectRow>,
) -> Vec<Diagnostic>Expand description
Check every knot/stitch’s #@effects(…) assertion in hir against
rows — that def’s inferred EffectRow, however the caller computed
it: the whole-project pure crate::effects_project for the analyzer’s
monolithic path, or, for the salsa-memoized production path, a small map
built from individual per-def effects(def) queries (only for the defs
that actually carry an assertion, preserving the advisory/lazy
invariant — an unannotated project never triggers effect inference at
all).
A def whose own id can’t be resolved, or whose row is missing from
rows, produces no diagnostic here — both are the caller’s contract to
uphold (every assertion-carrying def gets an entry), not a case this
function can distinguish from “not computed yet”.
scope is hir’s own ImportScope (issue #881, the T2 follow-up to
M-2d/#790): a reads/writes/calls clause name is resolved through the
exact same import-scoped [lookup_by_name] the reference resolver uses,
so a #@effects assertion in a file that imports one of several
same-name cross-module cells binds to that importer’s cell — never a
flat first-inserted winner that could silently name a different module’s
definition than the one the body’s own inferred row actually touches.