pub enum DiagnosticCode {
Show 26 variants
UnsupportedDirective,
InvalidFieldCount,
InvalidMonth,
AmbiguousNameAbbreviation,
InvalidDayRule,
InvalidTimeSuffix,
UnsupportedYearType,
OutputPathTraversal,
TooManyTransitions,
UnsupportedLeapSeconds,
ReferenceZicMismatch,
InvalidValue,
UnknownLineType,
ContinuationWithoutZone,
DuplicateZone,
NulByteInInput,
OverlongInputLine,
AbbreviationPolicyViolation,
AbbreviationNotPosix,
TooManyTransitionsForLegacyClient,
UnterminatedInputLine,
UnterminatedQuote,
SimultaneousTransition,
ZoneNameNonPortableByte,
ZoneNameOverlengthComponent,
ValueOverTwentyFourHours,
}Expand description
Stable diagnostic codes.
Numbering follows the project’s documented scheme; gaps are reserved for future use so existing codes never shift meaning.
Variants§
UnsupportedDirective
A directive/keyword we do not implement in this version.
InvalidFieldCount
A line had the wrong number of fields for its record type.
InvalidMonth
A month name was unrecognised or ambiguously abbreviated.
AmbiguousNameAbbreviation
A name abbreviation matched more than one keyword.
InvalidDayRule
An ON day specification was malformed.
InvalidTimeSuffix
An AT/SAVE time had an invalid suffix.
UnsupportedYearType
A FROM/TO year keyword we do not implement.
OutputPathTraversal
A zone/link name (or its output path) would escape the output root.
TooManyTransitions
A zone produced more transitions than the configured limit.
UnsupportedLeapSeconds
Leap-second input was supplied but is not implemented.
ReferenceZicMismatch
Our output disagreed with reference zic.
InvalidValue
A field value was syntactically invalid (offset, name, etc.).
UnknownLineType
A line in command position began with a token that is not a recognised record keyword
(Rule/Zone/Link). Lexical layer; reference zic reports “input line of unknown type”.
Distinct from UnsupportedDirective, which is a recognised
construct zic-rs deliberately does not compile (a safety/scope divergence, T13.1).
ContinuationWithoutZone
An indented (continuation-shaped) line appeared where no zone is open to continue. Structural
layer. zic-rs classifies this more precisely than reference zic (which folds it into “input
line of unknown type”) — a documented, intentional refinement, not a wording mismatch.
DuplicateZone
A second Zone was defined with a name already in use. Structural layer; carries the conflicting
name and the original definition’s line (mirrors reference zic’s “duplicate zone name N”).
NulByteInInput
The input contained a NUL byte (lexical/admissibility). Reference zic: “NUL input byte”.
OverlongInputLine
A source line exceeded the byte-length cap (lexical/admissibility). The cap (MAX_LINE_LEN)
was reconciled against reference zic in T14.1 and matches its _POSIX2_LINE_MAX = 2048
(the older “511” manpage figure is stale — verified against the pinned 2026b source).
AbbreviationPolicyViolation
A time-zone abbreviation’s length is outside the portable range (tzfile(5): 3–6
characters) — fewer than 3 or more than 6 — a non-fatal warning (the file still compiles).
Mirrors reference zic’s always-on “time zone abbreviation has too many characters (X)” /
“…has fewer than 3 characters (X)” (thresholds pinned empirically against tzcode 2026b). The
first non-fatal warning class (T13.3); the < 3 side was added in T13.4.
AbbreviationNotPosix
A time-zone abbreviation contains a character outside the POSIX-portable set (only ASCII
alphanumerics and +/-), a non-fatal warning. Mirrors reference zic’s “time zone
abbreviation differs from POSIX standard (X)” (T13.4). A distinct rule from the length
policy (AbbreviationPolicyViolation) — both can fire for
one abbreviation. (Case is not a violation: lowercase letters are alphanumeric and accepted.)
TooManyTransitionsForLegacyClient
The emitted transition count exceeds a client-compatibility threshold (an emitted-stream
warning, -v/verbose-only in reference zic). Pinned from zic.c: 1200 < timecnt →
“pre-2014 clients may mishandle more than 1200 transition times”, TZ_MAX_TIMES < timecnt →
“reference clients mishandle …”. Reserved class (T13.5): the code + reference rule are
recorded; emission is wired in T13.6 (gated by the verbosity model), since it depends on the
finished timecnt and must be quiet-by-default to match reference.
UnterminatedInputLine
The final input line has content but no terminating newline (lexical/admissibility). Mirrors
reference zic’s inputline: at EOF with linelen > 0 it reports “unterminated line” and exits.
A POSIX text file ends every line with \n; zic-rs was previously lenient here (accepted the
trailing partial line) — T14.2 makes it fail closed, matching reference. The class name is the
rule violated, not the wording (“unterminated line”).
UnterminatedQuote
A double-quoted field is opened but never closed before end-of-line (lexical/admissibility).
Mirrors reference zic’s getfields, which hits the line’s terminating \0 inside a quote and
reports “Odd number of quotation marks”, then exits. zic-rs already failed closed here but under
the generic InvalidValue (ZIC012); T14.2 gives it a dedicated class.
SimultaneousTransition
Two rules expand to a transition at the same instant (semantic). Mirrors reference zic’s
“two rules for same instant”, which it treats as a fatal error (errors=true → exit 1). zic-rs
fails closed with this code rather than emitting a non-monotonic (invalid) TZif — a same-instant
rule conflict is not silently resolved. Surfaced by the T14.4 pathology ledger, which found that
the prior debug_assert! would panic in debug / emit an invalid stream in release.
ZoneNameNonPortableByte
A zone/link name (which becomes an output path) contains a byte outside the portable benign
set (-, _, ASCII letters, and / as the separator) — e.g. a digit, +, ., or a high/control
byte. A non-fatal warning mirroring reference zic’s -v-gated “file name ‘%s’ contains byte
‘…’” (namecheck). The hard structural path rules (absolute · .. · // · empty · trailing
/) are fatal OutputPathTraversal; this is the softer portability
axis (T14.5). zic-rs has no quiet mode → collects always; surfaced only under --verbose.
ZoneNameOverlengthComponent
A single component of a zone/link name exceeds the portable length (reference zic’s
component_len_max = 14). A non-fatal warning mirroring zic’s -v-gated “file name ‘%s’
contains overlength component” (componentcheck); the file still compiles (T14.5).
ValueOverTwentyFourHours
A parsed time value (a STDOFF / SAVE / AT / UNTIL field) has a magnitude strictly
greater than 24:00:00. A non-fatal warning mirroring reference zic’s noise/-v-gated
gethms check (zic.c: hh > HOURSPERDAY || (hh == HOURSPERDAY && (mm||ss)) → “values over 24
hours not handled by pre-2007 versions of zic”). Exactly 24:00:00 does not warn; the file
still compiles. zic-rs has no quiet mode → collects always; surfaced only under --verbose
(T15.5-remainder; closes the T14.4 ledger residual).
Implementations§
Source§impl DiagnosticCode
impl DiagnosticCode
Sourcepub fn layer(self) -> DiagnosticLayer
pub fn layer(self) -> DiagnosticLayer
The DiagnosticLayer this code belongs to (T13.5 — the comparison method’s first axis). The
match is exhaustive, so adding a code without classifying it is a compile error — the taxonomy
stays in lock-step with docs/zic-warning-parity.md.
Sourcepub fn span_precision(self) -> DiagnosticSpanPrecision
pub fn span_precision(self) -> DiagnosticSpanPrecision
The DiagnosticSpanPrecision this code currently populates (T13.5 audit, made machine-checked
in T13.6). Exhaustive — a new code must declare its precision or the build fails. Records the
current level, not a perfection claim (exact token columns are a future refinement for several
Line classes).
Sourcepub fn default_severity(self) -> Severity
pub fn default_severity(self) -> Severity
The canonical severity of this code (T13.6 — completes the per-code contract metadata so
every code carries (layer, span_precision, default_severity); exhaustive → adding a code
forces a classification). The three non-fatal abbreviation/transition warnings are Warning;
every other code is a fail-closed Error. Canonical, not absolute: the warn-and-skip
policy may downgrade an emitted error-diagnostic to Warning at the instance level (see
plan::run), and verbosity is the one genuinely per-instance axis (a Diagnostic cannot
be constructed without a severity and a verbosity, so those are type-enforced on every
instance — see Diagnostic).
Trait Implementations§
Source§impl Clone for DiagnosticCode
impl Clone for DiagnosticCode
Source§fn clone(&self) -> DiagnosticCode
fn clone(&self) -> DiagnosticCode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DiagnosticCode
Source§impl Debug for DiagnosticCode
impl Debug for DiagnosticCode
Source§impl Display for DiagnosticCode
impl Display for DiagnosticCode
impl Eq for DiagnosticCode
Source§impl PartialEq for DiagnosticCode
impl PartialEq for DiagnosticCode
Source§fn eq(&self, other: &DiagnosticCode) -> bool
fn eq(&self, other: &DiagnosticCode) -> bool
self and other values to be equal, and is used by ==.