Skip to main content

Module codes

Module codes 

Source
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 DiagnosticCode answers “which rule fired?” It is an opaque, namespaced, severity-free identifier rendered as MOS0010. 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 DiagnosticDef pairs that code with its slug, default severity, category, owning crate, and a one-line summary. The catalog groups by DiagnosticCategory, not by numeric range — so a rule that moves phases (parser → eval, fonts → text shaping) keeps its stable ID and just updates its category.

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§

DiagnosticCode
Stable, severity-free diagnostic identifier (manifest §16).
DiagnosticDef
Registry entry: one code, its slug, default severity, category, owner, summary.

Enums§

DiagnosticCategory
What kind of thing a diagnostic describes.

Statics§

ALL
Every registered diagnostic definition, in declaration order.
MOS0010
#set not followed by an identifier.
MOS0011
Unknown #set target (only page, 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 #set value breaks page geometry; previous value kept.
MOS0024
#set rejecting 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
#set value 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 /Differences glyph budget exhausted for a face.
MOS0033
@label reference 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).