docs

#Error codes

On this page

Every nabic diagnostic starts with a code: error[E0040]: mismatched types: .... There is one code per kind of error, so one code covers many messages; the message itself says what is wrong and, usually, what to write instead. nabic --explain E0040 (or nabi --explain E0040) prints a short explanation of a code; its page here says the same and shows an example. With --message-format=json the code is the code field and its area the kind field (9.9.4 Diagnostics).

Codes are numbered in the order they were added, from E0001 up with no gaps. This index describes nabic 0.1.0. Most pages show an example, checked against the real compiler output when the docs are built, and its fix.

#Lexical

CodeKindTitle
E0001lexicalunexpected character in source
E0002lexicalbidirectional control character in source
E0003lexicalmalformed numeric literal
E0004lexicalliteral out of range for its type
E0005lexicalunterminated literal or comment
E0006lexicalinvalid escape in a literal
E0007lexicala character literal holds one character
E0008lexicalmalformed f-string
E0009lexicalname cannot be a raw identifier
E0147lexicalinvisible character in code
E0148lexicalcharacter that only looks like a token

#Syntax

CodeKindTitle
E0010parseunexpected token
E0011parsenesting too deep
E0012parsesyntax from another language
E0013parsestruct literal in a block head
E0014parsemodifiers out of order
E0015parsedoc comment documents nothing
E0016parsevisibility where it has no meaning
E0017parseitem in the wrong place
E0018parsereturn with a value in top-level statements
E0019parseoperators that need parentheses
E0020parsereturn in a trailing closure
E0021parsereserved word used as a name
E0022parselet without a value
E0023parseinvalid function signature
E0024parseinvalid generic parameters
E0025parseunsupported ABI

#Names and modules

CodeKindTitle
E0026resolvename defined more than once
E0027resolvecannot find value or function
E0028resolvecannot find type or trait
E0029resolvecannot find enum variant
E0030moduleunresolved import
E0031resolveambiguous name
E0032moduleconflicting imports
E0033moduleinvalid re-export
E0034visibilityitem is private
E0035modulemodule file problem
E0036moduleinvalid program entry point
E0037moduleinvalid dependency
E0038resolvevariable named like a nested function
E0039resolvenested item uses an outer local
E0128moduleinvalid WIT
E0135resolvetrait of the method not in scope
E0141resolvemethod generic parameter named like its impl's

#Types

CodeKindTitle
E0040typemismatched types
E0041typebranches of different types
E0042typetype annotations needed
E0043typeno such field
E0044typemissing field in a literal
E0045typefield given more than once
E0046typeno such method or associated item
E0047typeitem used in the wrong form
E0048typewrong number of arguments
E0049typeinvalid named argument
E0050typeref parameter and argument mismatch
E0051typeinvalid spread argument
E0052typevalue is not callable
E0053typeinvalid cast
E0054typeoperator cannot be applied
E0055typeliteral fits several types
E0056typeinvalid indexing
E0057typeinvalid assignment
E0058typeinvalid closure capture
E0059typekeyword outside its context
E0060typelet .. else that does not diverge
E0061typeoperation needs unsafe
E0062typeerror not handled
E0063typethrown value is not an Error
E0064typeoptional operator on a value that is not optional
E0065typelock guard not released by using
E0066typeusing on a value without Drop
E0067typeblock statement leaves a value
E0068typevalue cannot be iterated
E0069typetrait bound not satisfied
E0070typenot a trait
E0071typetrait used as a type
E0072typeimpl is missing a trait item
E0073typeimpl item is not in the trait
E0074typeimpl item does not match the trait
E0075typeconflicting implementations
E0076typeimpl of a foreign trait for a foreign type
E0077typesupertrait not implemented
E0078typeimpl not allowed
E0079typecannot evaluate at compile time
E0080typedefinition depends on itself
E0081typeinvalid const generic argument
E0082typewrong generic arguments
E0083typeinvalid enum value
E0084typeinvalid foreign-function use
E0085typevalue cannot cross threads
E0086typeinvalid union
E0087typeambiguous associated item
E0088typeinvalid format
E0089typeinvalid compiler built-in call
E0090typeinvalid coroutine use
E0091typeinvalid broadcast
E0092typeDrop::drop called directly
E0093typegeneric instantiation too deep
E0094typeinvalid representation
E0095typetype too large
E0096typetry or catch that does nothing
E0097typeNABION value of the wrong shape
E0138typepub function signature not written out
E0140typeassignment to a value that is not a place
E0142typerows of an array literal differ in length
E0143typemulti-axis index on a type indexed along one axis
E0144typeinteger raised to a negative power
E0145typenamed some type not defined by its module
E0146typenamed some type used as its concrete type

#Patterns

CodeKindTitle
E0098patternnon-exhaustive match
E0099patternunreachable match arm
E0100patternpattern does not fit the value's type
E0101patternwrong number of fields in a pattern
E0102patternor-pattern alternatives bind differently
E0103patternbinding looks like a variant
E0104patterninvalid rest pattern

#Hand-off and resources

CodeKindTitle
E0105handoffvalue used after it was handed over
E0106handoffvalue used after its lock was released
E0107handoffshared value handed over
E0133handoffresource used after it was moved or closed
E0134handoffresource not closed
E0136handoffthread-local value kept past with
E0137handofflist view used after a resize
E0139handoffstream view used past its stream

#Attributes and meta

CodeKindTitle
E0108metacannot derive
E0109metamalformed attribute
E0110metaattribute on the wrong item
E0111metainvalid #[lang] item
E0112metainvalid operator declaration
E0113metainvalid #[keyword] declaration
E0114metainvalid literal handler
E0115metainvalid #[intrinsic]
E0116metamalformed macro definition
E0117metano macro rule matches
E0118metainvalid meta template
E0119metainvalid meta block
E0120metarecursive expansion
E0121metainvalid cfg predicate
E0122metafile include failed
E0123metaregistered twice
E0124metameta name cannot be resolved

#Build and back end

CodeKindTitle
E0125othercannot read or write a file
E0126linkagelink failed
E0127linkageexternal tool failed
E0129unsupportednot supported by this backend
E0130internalinternal compiler error
E0132otherinvalid compiler option
E0149typechange a running program cannot take

#Lints

CodeKindTitle
E0131lintlint

Found a mistake? Edit this page on GitHub. Last updated