Expand description
Diagnostic code registry — the single source of truth for every diagnostic the compiler can emit.
Identity and severity are deliberately separate axes:
- A
DiagnosticCodeanswers “which rule fired?” It is an opaque, namespaced, severity-free identifier rendered asMOS0010. The number has no semantic meaning — it does not encode severity, owner crate, category, or lint group. Numbers are globally unique and stable; new codes get the next free integer regardless of what they describe. - A
DiagnosticDefpairs that code with its slug, default severity, category, owning crate, and a one-line summary. The catalog groups byDiagnosticCategory, not by numeric range — so a rule that moves phases (parser → eval, fonts → text shaping) keeps its stable ID and just updates itscategory.
Both DiagnosticCode and DiagnosticDef have crate-private fields
and crate-private constructors, so the only place a code or def can
be minted is the define_codes! invocation below. Outside crates
reference the pub static defs (&codes::MOS0010) and can neither
forge new ones nor disagree with a code’s registered severity.
Structs§
- Diagnostic
Code - Stable, severity-free diagnostic identifier (manifest §16).
- Diagnostic
Def - Registry entry: one code, its slug, default severity, category, owner, summary.
Enums§
- Diagnostic
Category - What kind of thing a diagnostic describes.
Statics§
- ALL
- Every registered diagnostic definition, in declaration order.
- MOS0010
#setnot followed by an identifier.- MOS0011
- Unknown
#settarget (onlypage,text,document,image). - MOS0012
- Image file cannot be read from disk.
- MOS0013
- Missing
(after#set NAME,#image, or#figure. - MOS0014
- PDF backend I/O failure (cannot create dir or write bytes).
- MOS0015
- Unknown keyword argument for
#set TARGET,#image, or#figure. - MOS0016
- Unterminated
#NAME(...)or#NAME[[...]]block. - MOS0017
- Unknown paper size in
#set page(paper: ...). - MOS0018
- Unknown font family; falling back to bundled Noto Sans.
- MOS0019
- Unexpected trailing content after a directive on the same line.
- MOS0020
- Argument type mismatch or non-positive length.
- MOS0021
- Internal: missing embedded font plan for a shaped run.
- MOS0022
- Malformed directive argument value (bad escape, unknown unit,
unterminated string, lone
-, malformed number/length). - MOS0023
- Well-typed
#setvalue breaks page geometry; previous value kept. - MOS0024
#setrejecting a positional argument where named is required.- MOS0025
- Argument-list shape error (missing
:, missing,/), positional where named expected). - MOS0026
- Font subsetting failure for an embedded face.
- MOS0027
#setvalue passes typing but trips a sanity floor; still applied.- MOS0028
- Unterminated
**strong**run; treated as literal text. - MOS0029
- Image file cannot be decoded (unsupported or corrupt).
- MOS0030
- Label declared more than once; first declaration wins.
- MOS0031
- Unterminated
*emphasis*run; treated as literal text. - MOS0032
- Base-14
/Differencesglyph budget exhausted for a face. - MOS0033
@labelreference to a label that does not exist.- MOS0034
- Unterminated
`code`run; treated as literal text. - MOS0035
- Image reached layout without decoded pixels; skipped on the page.
- MOS0036
- Stray
@not followed by a label identifier; treated as text. - MOS0037
#image(...)/#figure(...)missing a path argument.- MOS0038
- Lone trailing
\at end of input; treated as literal text. - MOS0039
- Malformed citation group; treated as literal text.
- MOS0040
#bibliography(...)missing a path argument.- MOS0041
- Declared
#bibliography(...)source file is not on disk. - MOS0042
#bibliography(...)path declared more than once; first wins.- MOS0043
- BibTeX database could not be parsed (
mos-bib). - MOS0044
- CSL style could not be parsed (
mos-csl).