Skip to main content

Module diagnostics

Module diagnostics 

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§

DiagnosticInfo
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.

Constants§

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".
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 behind docs/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.