Skip to content

Diagnostics reference ​

Every memory-model diagnostic has a stable code. The code and the primary source position are stable; the message text, labels and help: line may change. Errors stop the build (exit status 1); warnings do not, unless you pass -Werror.

The pages below are generated by website/scripts/gen-diagnostics.mjs from the test corpus compiler/testdata/memory/ and the output of the real compiler, so they cannot drift from the implementation. Only the prose is hand-written.

CodeSeverityMeaningCorpus programs
M0101errorUse after free5
M0102errorLeak: allocation is never released13
M0103errorDouble free3
M0104errorUse after move7
M0105errorEscape from a Scoped allocator5
M0106errorIndividual free of a Scoped object2
M0107errorRelease of a non-owned value3
M0108errorWrong allocator when freeing1
M0109errorLoan is stored or returned as owned3
M0110errorViolation of the Strict/Managed boundary3
M0111errorInvalid ownership annotation1
M0112errorOwning value in an escaping lambda1
M0113errorOwned field stays moved1
M0114errorAmbiguous allocator1
M0115errorArena object owns a foreign reference3
M0201info (planned)Allocation moved to the stack0
M0202warningAllocation in an arena loop1
M0203warning (planned)Large object on the stack0
M0204errorNo allocator for an escaping Strict value1
M0205errorAllocation in a @NoAlloc function1
M0206errorObject leaves the thread but its allocator is not ThreadSafe1

Output format ​

text
<severity>[<code>]: <message>
  --> <file>:<line>:<col>   <label>
   <line> | <source line>
          | <caret under the primary position>
  help: <text>

note: <code> (<title>): <link to its page>

Every code that was reported is named once at the end with its title and the link to its page. For editors and tools, the released minic (the self-hosted one) prints, with --error-format=json, one JSON object per diagnostic on stderr (severity, code, message, file, line, col, endCol, label, secondary, help, docs); --color=always|never|auto and NO_COLOR control colors and --error-limit=N stops printing after N diagnostics.

With ./minic check --brief file.kt the compiler prints only line:col: CODE lines on stdout; this is what the test corpus compares.

Released under the Apache License 2.0.