Warning Codes
This page is generated by scripts/docs/gen-error-code-docs.py from the define_codes! registry in src/util/diagnostic/codes/ and locales/en.json. Do not edit it by hand. Change the wording in locales/*.json, change the code table in define_codes!, then rerun python scripts/docs/gen-error-code-docs.py.
Warning codes start with W and report problems the code may contain; their default emission level is warn, which does not block compilation. The exception is W1090, whose emission level is error (a user ruling of 2026-10-13 upgraded the same code to E; see its entry): when it fires it counts toward error_count and changes the exit code, so it blocks compilation. The registry currently holds 12 warning codes; see the error code index for the complete inventory.
Configuration
Configure dead-code warnings in yaoxiang.toml:
[lint]
# Dead code warning level: off | warn | deny
dead-code = "warn"off: disable the warningwarn: show the warning (default)deny: treat the warning as an error and block compilation
Code Overview
| Code | Name | span exempt | Template | Emission sites |
|---|---|---|---|---|
W1001 | Unused private function | No | unused function: '{name}' | ✅ 1 site |
W1002 | Unused private type | No | unused type: '{name}' | ✅ 1 site |
W1003 | Unused import | No | unused import: '{name}' | ✅ 1 site |
W1004 | Unused private variable | No | unused variable: '{name}' | ✅ 1 site |
W1005 | Unused private method | No | Unused method: '{name}' | ✅ 1 site |
W1006 | Local module shadows dependency package | No | local module '{module}' shadows dependency package '{dependency}' | ✅ 2 sites |
W1007 | Module import cycle | No | Module import cycle {cycle}: initialization order within the cycle cannot be determined; the order within the cycle follows a deterministic convention based only on lexicographic path order (not a semantic guarantee) | ✅ 1 site |
W1063 | Const generic constraint cannot be evaluated | No | const generic constraint cannot be evaluated: \`` | ✅ 1 site |
W1080 | Compile-time proof downgraded | No | The constraint cannot be proven at compile-time; downgraded to a runtime check | ⚠ Not yet emitted |
W1081 | Termination obligation undecided | No | {count} termination measure obligation(s) undecided (SMT solver unavailable) | ✅ 1 site |
W1082 | Ownership analysis degraded | No | ownership analysis degraded: this compilation has no body checker (type ledger and call-ownership table missing), so ownership was judged against an empty ledger and borrow conflicts were not checked | ✅ 1 site |
W1090 | Obligation produced but never consumed | Yes | obligation field \` was produced in {file} but never consumed: {detail}` | ✅ 2 sites |
Code Details
W1001: Unused private function
- Category:
Warning - span exempt: No
- Template:
unused function: '{name}' - Help: Function is never referenced, consider removing it or adding a call; this warning is not reported when referenced by other files in the package
- Emission sites:
src/frontend/core/sema/passes/dead_code.rs:951
W1002: Unused private type
- Category:
Warning - span exempt: No
- Template:
unused type: '{name}' - Help: Type is never referenced, consider removing it or using the type; this warning is not reported when referenced by other files in the package
- Emission sites:
src/frontend/core/sema/passes/dead_code.rs:952
W1003: Unused import
- Category:
Warning - span exempt: No
- Template:
unused import: '{name}' - Help: consider removing the unused import
- Emission sites:
src/frontend/core/sema/checker/use_import.rs:392
W1004: Unused private variable
- Category:
Warning - span exempt: No
- Template:
unused variable: '{name}' - Help: Variable is never referenced, consider removing it or using the variable; this warning is not reported when referenced by other files in the package
- Emission sites:
src/frontend/core/sema/passes/dead_code.rs:953
W1005: Unused private method
- Category:
Warning - span exempt: No
- Template:
Unused method: '{name}' - Help: Method is never referenced, consider removing it or adding a call; this warning is not reported when referenced by other files in the package
- Emission sites:
src/frontend/core/sema/passes/dead_code.rs:954
W1006: Local module shadows dependency package
- Category:
Warning - span exempt: No
- Template:
local module '{module}' shadows dependency package '{dependency}' - Help: Local module resolution has the highest priority (RFC-014): './src/{module}' overrides the dependency package '{dependency}' in .yaoxiang/vendor/. If the shadowing is unintended, rename the local module; use --deny-shadowing to upgrade it to an error
- Emission sites:
src/driver/arms.rs:699,src/util/diagnostic/command.rs:94
W1007: Module import cycle
- Category:
Warning - span exempt: No
- Template:
Module import cycle {cycle}: initialization order within the cycle cannot be determined; the order within the cycle follows a deterministic convention based only on lexicographic path order (not a semantic guarantee) - Help: Initialization order follows the topological order of use dependencies; inside a cycle the only rule is the deterministic path-lexicographic tie-break, which is not a semantic guarantee. Break the cycle (move one use out of the cycle, or defer the value behind a function) to make the order decidable. E3019 covers cycles between top-level bindings inside one unit; this code covers import cycles between modules.
- Emission sites:
src/driver/arms.rs:1864
W1063: Const generic constraint cannot be evaluated
- Category:
Warning - span exempt: No
- Template:
const generic constraint cannot be evaluated: \`` - Help: ensure the const parameter is a compile-time constant
- Emission sites:
src/frontend/core/sema/checker.rs:1452
W1080: Compile-time proof downgraded
- Category:
Warning - span exempt: No
- Template:
The constraint cannot be proven at compile-time; downgraded to a runtime check - Help: Consider adding a proof function to improve safety
- Emission site: ⚠ Not yet emitted (the registry retains the code, but non-test code never calls it)
W1081: Termination obligation undecided
- Category:
Warning - span exempt: No
- Template:
{count} termination measure obligation(s) undecided (SMT solver unavailable) - Help: re-check after installing the Z3 solver to obtain termination decisions; "undecided" does not mean "does not terminate", but the decision of obligations was skipped
- Emission sites:
src/frontend/core/sema/checker.rs:1439
W1082: Ownership analysis degraded
- Category:
Warning - span exempt: No
- Template:
ownership analysis degraded: this compilation has no body checker (type ledger and call-ownership table missing), so ownership was judged against an empty ledger and borrow conflicts were not checked - Help: This is an internal stage-contract defect, not a mistake in your program: the ownership layer could not obtain the type ledger and call-ownership table produced by the body checker, so it passed everything as conflict-free and skipped borrow-conflict checking entirely. Please report this diagnostic together with a minimal reproduction as an issue.
- Emission sites:
src/frontend/core/sema/checker.rs:1532
W1090: Obligation produced but never consumed
- Category:
Warning - span exempt: Yes
- Template:
obligation field \` was produced in {file} but never consumed: {detail}` - Help: This is a stage contract defect inside the compiler, not a bug in your program: an obligation field produced by one stage was not read by the next stage, and the effect of the obligation may have been silently discarded. Please report this diagnostic along with the field name and file path as an issue, and attach a minimal reproduction program. This code belongs to the W family (code prefix W), but the emission level is error: when triggered, it counts toward error_count and changes the exit code. Note: a healthy program emits zero (no report when all obligations have delivery markers), so the upgrade only affects the build result when this defect actually occurs.
- Emission sites:
src/driver/obligations.rs:105,src/driver/obligations.rs:578
Warning Levels
| Level | Effect |
|---|---|
off | Disable this warning entirely |
warn | Show the warning and continue compiling (default) |
deny | Treat the warning as an error and block compilation |
Difference from Error Codes
- Errors (
Eprefix): block compilation and must be fixed. - Warnings (
Wprefix): report potential problems; their default emission level iswarn, and fixing them is optional. The exception isW1090, whose emission level iserror: when it fires it counts toward error_count and changes the exit code, so it blocks compilation and must be fixed (see its entry).
What Dead-Code Warnings Cover
W1001–W1005 report unused private (non-pub) functions, types, variables, and methods. A pub declaration is part of the public interface, and the compiler cannot know whether anything outside consumes it, so these warnings never fire for it (decision B of #321). When an "unused" warning appears, removing the corresponding pub removes the warning; conversely, keep pub on the declarations that other code must call.
