Skip to content

Diagnostics Reference

Every Zynx error and warning carries a stable diagnostic code — ZP0001, ZA0002, and so on. The code is printed alongside the message, and is the part of a diagnostic that stays constant even if the wording around it changes.

Run zynx --explain <CODE> to print the full explanation for any code, including the rule it enforces and how to fix a violation:

text
$ zynx --explain ZB0001
ZB0001: borrow-after-move
a value is used after it was moved out of

Moving a value transfers ownership; the source binding is left empty and
may not be read afterwards. Either borrow the value instead of moving it,
clone it if a second owned copy is needed, or restructure so the move is
the last use.

This page is a look-up appendix: one row per code, with a one-line summary. It does not teach the underlying language rules — those live in the language reference; this page is what the reference links to when it mentions a code. For the full explanation of any single code, use --explain.

Codes are grouped by a letter prefix that identifies the compiler stage that raises them, followed by four digits. Numbering within a prefix is not sequential — gaps are reserved for related diagnostics added later.

  • ZP — parsing and syntax
  • ZA — name resolution, types, and semantic analysis
  • ZB — borrowing, ownership, and moves
  • ZC — code generation and ABI

Parse diagnostics (ZP)

CodeMeaning
ZP0001An item that is not a top-level declaration appears at module scope.
ZP0010An expression was required here but the parser found something else.
ZP0011A type was required here but the parser found something else.
ZP0012A struct body contains something that is not a valid member.
ZP0030A match arm does not begin with a valid pattern.
ZP0031A match arm pattern is not followed by an arm body.
ZP0032An identifier does not satisfy the Unicode identifier rule.
ZP0033Two match arms are not separated by a comma.
ZP0034Legacy thread_local var/thread_local let syntax must migrate to a module-level ThreadLocal<T> descriptor.
ZP0035A tuple destructuring pattern is introduced with const.
ZP0036A struct field is declared with const.
ZP0037A type uses the removed const read-only-view prefix.
ZP0038Migration mode found a legacy writable bare pointer that must become *mut T.

Analysis diagnostics (ZA)

CodeMeaning
ZA0001A value's type does not match the type required by its context.
ZA0002A name does not resolve to anything in the current scope.
ZA0010A type argument does not satisfy the interface bound on a generic parameter.
ZA0011A generic item is instantiated with the wrong number of type arguments.
ZA0012A type name does not resolve to anything in the current scope.
ZA0013A const generic argument does not fit in its declared parameter type.
ZA0030A call names a function that does not resolve in the current scope.
ZA0031A closure is called with the wrong number of arguments.
ZA0032A call targets a name that is not a function or initializer.
ZA0050A builtin was called with the wrong number of arguments.
ZA0051A builtin argument has a type the builtin does not accept.
ZA0052A name written as @name is not a known builtin.
ZA0070Member access is used on a value whose type has no members.
ZA0071A struct value is accessed through a field or method it does not declare.
ZA0072A readonly field is assigned from outside its declaring struct.
ZA0073A private field is accessed from outside its declaring struct.
ZA0090An arithmetic operator was applied to a non-numeric operand.
ZA0091The two operands of an arithmetic operator have different types.
ZA0092A bitwise or shift operator was applied to a non-integer operand.
ZA0093The two operands of a comparison have different types.
ZA0094A comparison operator was applied to an operand it does not support.
ZA0095A unary operator was applied to an operand it does not support.
ZA0110A returned value's type does not match the function's declared return type.
ZA0111A function with a non-void return type returns without a value.
ZA0112A value is returned from a function that returns no value.
ZA0113A thrown error is not a member of the function's declared throws(...) set.
ZA0120A struct literal names a field the struct does not declare.
ZA0121A struct literal initializes a private-by-default field that was not exported.
ZA0122A struct literal initializes the same field twice.
ZA0123A value in a struct literal does not match its field's type.
ZA0124A struct literal does not initialize a required field.
ZA0140A match does not cover every possible value of its scrutinee.
ZA0141A match pattern names a variant the enum does not declare.
ZA0142A match arm's pattern does not match the type of the scrutinee.
ZA0160Two enum variants resolve to the same discriminant.
ZA0161An enum variant discriminant does not fit the backing type.
ZA0162An explicit discriminant was given on a non-C-ABI enum.
ZA0163A C ABI enum variant carries a payload.
ZA0180A from import names a member the module does not export.
ZA0181A from import names a member the module declares but does not export.
ZA0200An init leaves a field without a default uninitialized.
ZA0220A call does not match the signature of the only function with that name.
ZA0221No overload of a function accepts the supplied arguments.
ZA0241A type alias refers to itself through its own definition.
ZA0242An array literal has a different number of elements than its declared size.
ZA0243A @noreturn function declares a return type other than void or never.
ZA0260A closure sent across worker threads captures a value that is not send-safe.
ZA0280A const binding is assigned to after its initial value.
ZA0281An immutable binding is assigned to after its initial value.
ZA0282A mutable reference is taken to an immutable binding.
ZA0283A mutating &self method is called on an immutable binding.
ZA0284A field or element of an immutable binding is assigned to.
ZA0285A local const binding's initializer is not a compile-time constant.
ZA0286An immutable binding is initialized from inside a loop.
ZA0300A named owned place is passed to a ^ parameter without an explicit <-.
ZA0301An owning position uses a bare move-only type instead of ^T.

Borrow and ownership diagnostics (ZB)

CodeMeaning
ZB0001A value is used after it was moved out of.
ZB0002A value is accessed while an incompatible borrow of it is still live.
ZB0003A borrow is captured by something that outlives the borrowed value.
ZB0004An owned value is moved out of a shared borrow.
ZB0005An owned element cannot be moved out of this place.
ZB0006A range-slice view cannot be coerced into an owning slice.

Codegen and ABI diagnostics (ZC)

CodeMeaning
ZC0001A type cannot cross the declared foreign ABI boundary.

Coverage

Every code above is wired to a real emission site in the compiler; none are placeholders. The registry does not currently define any internal-only or selftest-only codes, so nothing was excluded from this page.

Released under the MIT License.