diag: add stable source reasons and diagnostic incidence reporting

This commit is contained in:
dev committed 2026-10-07 18:52:36 +03:00
1 parent 911982dd1c
commit dbd9763713
21 files changed
+571 -156

No files matched your search

+36 -1
View File
@@ -91,7 +91,7 @@ Only problems that exist because of the frontend. Everything the verifier decide
| E7003 | source.missing_move | Named linear value consumed without `move` |
| E7004 | source.not_exhaustive | `match` misses an outcome, variant or default |
| E7005 | source.type_mismatch | Expression has the wrong type in a source position |
| E7006 | source.invalid_construct | Construct not allowed here |
| E7006 | source.invalid_construct | Construct not allowed here; stable `reason` below |
| E7007 | source.ambiguous | Source meaning cannot be determined |
| E7900 | source.internal_compiler_error | The frontend produced invalid AIR for this construct: a compiler bug, not a program error; fields `air_code`, `air_message` |
@@ -111,3 +111,38 @@ Reported in trap records (spec 01 §6), not by the verifier.
| T0008 | trap.out_of_bounds | Runtime bounds check failed |
| T0009 | trap.unsafe_precondition | Unsafe precondition violated (detected) |
| T0010 | trap.foreign_iref | An `iref` was used to access a graph it does not belong to |
## E7006 reasons
These stable categories are part of the diagnostic API (spec 15 §10), not new rejection rules. One reason is selected at the rejection site; messages remain optional explanation.
| Reason | Meaning |
|---|---|
| `move_copy` | Explicit move of a plain Copy value; excludes borrows, void and never. |
| `move_borrow` | Explicit move of a borrow/view. |
| `invalid_move` | Move operand is void or never, rather than a materializable value. |
| `loop_control_outside_loop` | break or continue without an enclosing loop. |
| `zero_not_zeroable` | zero initialization of a type without a zero value. |
| `value_block_statement` | A bare block statement would implicitly discard a non-void value. |
| `unreachable` | Statement or expression after unconditional divergence. |
| `missing_return` | A value-returning function can fall through without a value. |
| `invalid_borrow` | A borrow requires an explicit binding, mode, named parent or argument form. |
| `invalid_borrow_return` | A borrow return violates source origin, binding, return or worker restrictions. |
| `duplicate_declaration` | Duplicate type, function, field, variant or parameter declaration. |
| `invalid_declaration` | An otherwise disallowed declaration shape, such as an empty enum. |
| `invalid_binding` | Invalid binding shape, rebinding or implicit borrow binding. |
| `invalid_assignment` | Assignment requires a mutable variable or a permitted stored element/field. |
| `invalid_place` | Expression is not an addressable place or uses an invalid unchecked projection. |
| `invalid_match` | Invalid, duplicate or misplaced pattern, outcome or select arm. |
| `invalid_unpack` | Invalid complete unpack or multi-result binding form. |
| `invalid_expression` | Value expression uses an unavailable form, such as scalar dereference of a slice. |
| `invalid_operation` | Invalid intrinsic/call, fallibility handler, multi-result handler or ordering spelling. |
| `invalid_literal` | Invalid literal shape, duplicate/missing initializer field or borrowed element. |
| `invalid_generic` | Invalid generic parameter, constraint, argument, entry point or application. |
| `invalid_static_function` | Static callable contract, parameter use or specialization is disallowed. |
| `implementation_limit` | A specified frontend/module/type/specialization size or depth limit is exceeded. |
| `invalid_module_mapping` | Invalid reserved, duplicate or excessive package module mapping. |
| `duplicate_import` | The same module is imported twice. |
| `import_cycle` | Cyclic module import. |
| `module_header_mismatch` | Mapped module header differs from its explicit provider name. |
| `trusted_unavailable` | A source program/template declares an unavailable trusted boundary. |