Expand description
Central registry of diagnostic codes.
This is the single source of truth for the bynk.* codes the compiler can
emit. The reference page site/src/content/docs/book/reference/diagnostics.md is generated
from render_markdown, and the test tests/diagnostics_registry.rs
asserts that this table matches exactly the set of codes used across the
compiler source — so a new code cannot be introduced without documenting it
here, and a removed code cannot linger in the docs.
Each entry is a (code, summary) pair, optionally tagged with the grammar
production(s) it constrains (grammar_symbol). The category shown in the
generated reference is derived from the second dotted segment of the code;
the grammar weave (docs/grammar-semantics.json, the
{{#grammar-semantics}} directive, and the diagnostics page’s Construct
column) is generated from grammar_symbol.
Structs§
- Diagnostic
Info - One documented diagnostic: its stable code and a one-line summary of the cause. Richer “cause and fix” material for the common diagnostics lives in the troubleshooting how-to guides.
- Explain
- A curated, offline-complete explanation of a diagnostic code (#853).
Constants§
- BOOK_
BASE_ URL - The hosted Book, the stable target for
codeDescriptionlinks (#853, DECISION C). No trailing slash — anExplain::pagepath (which begins with/) is appended directly. - EXPLANATIONS
- The curated explanations, keyed by code (DECISION B: highest-traffic,
newcomer-facing codes first). Kept sorted by code; every
codemust be a realREGISTRYentry and everypagean existing Book page — both enforced bytests/diagnostics_registry.rs. - REGISTRY
- Every diagnostic code the compiler emits, sorted by code.
Functions§
- category
- The category segment of a code (the part between the first two dots), e.g.
"types"for"bynk.types.type_mismatch". - explain
- The curated explanation for a diagnostic
code, orNonewhen the code has no explanation yet (the designed graceful-fallback state, DECISION B). - render_
grammar_ semantics_ json - Invert the registry into a
{ "<rule>": [ { code, summary }, … ], … }map, serialised as pretty JSON with sorted keys and sorted codes. Only rules with at least one diagnostic appear. This is the generator behinddocs/grammar-semantics.json, which the{{#grammar-semantics <rule>}}preprocessor directive consumes. - render_
markdown - Render the diagnostic index as a Markdown reference page, grouped by
category. This is the generator behind
site/src/content/docs/book/reference/diagnostics.md.