pub enum ErrorKind {
Show 86 variants
UnexpectedCharacter(char),
InvalidInteger,
InvalidFloat,
InvalidStringEscape(char),
UnterminatedString,
UnexpectedToken {
expected: Cow<'static, str>,
found: Cow<'static, str>,
},
UnexpectedEof {
expected: Cow<'static, str>,
},
ParseError(String),
NoMainFunction,
UndefinedVariable(String),
UndefinedFunction(String),
AssignToImmutable(String),
UnknownType(String),
UseAfterMove(String),
CannotMoveField {
type_name: String,
field: String,
},
TypeMismatch {
expected: String,
found: String,
},
WrongArgumentCount {
expected: usize,
found: usize,
},
MissingFields(Box<MissingFieldsError>),
UnknownField {
struct_name: String,
field_name: String,
},
DuplicateField {
struct_name: String,
field_name: String,
},
MissingFieldInDestructure {
struct_name: String,
field: String,
},
EmptyStruct,
EmptyAnonEnum,
CopyStructNonCopyField(Box<CopyStructNonCopyFieldError>),
ReservedTypeName {
type_name: String,
},
DuplicateTypeDefinition {
type_name: String,
},
LinearValueNotConsumed(String),
LinearStructCopy(String),
HandleStructMissingMethod {
struct_name: String,
},
HandleMethodWrongSignature {
struct_name: String,
found_signature: String,
},
DuplicateMethod {
type_name: String,
method_name: String,
},
UndefinedMethod {
type_name: String,
method_name: String,
},
UndefinedAssocFn {
type_name: String,
function_name: String,
},
MethodCallOnNonStruct {
found: String,
method_name: String,
},
MethodCalledAsAssocFn {
type_name: String,
method_name: String,
},
AssocFnCalledAsMethod {
type_name: String,
function_name: String,
},
DuplicateDestructor {
type_name: String,
},
DestructorUnknownType {
type_name: String,
},
DuplicateConstant {
name: String,
kind: String,
},
ConstExprNotSupported {
expr_kind: String,
},
DuplicateVariant {
enum_name: String,
variant_name: String,
},
UnknownVariant {
enum_name: String,
variant_name: String,
},
UnknownEnumType(String),
FieldWrongOrder(Box<FieldWrongOrderError>),
FieldAccessOnNonStruct {
found: String,
},
InvalidAssignmentTarget,
InoutNonLvalue,
InoutExclusiveAccess {
variable: String,
},
BorrowNonLvalue,
MutateBorrowedValue {
variable: String,
},
MoveOutOfBorrow {
variable: String,
},
BorrowInoutConflict {
variable: String,
},
InoutKeywordMissing,
BorrowKeywordMissing,
BreakOutsideLoop,
BreakInConsumingForLoop {
element_type: String,
},
ContinueOutsideLoop,
IntrinsicRequiresChecked(String),
UncheckedCallRequiresChecked(String),
NonExhaustiveMatch,
EmptyMatch,
InvalidMatchType(String),
UnknownIntrinsic(String),
IntrinsicWrongArgCount {
name: String,
expected: usize,
found: usize,
},
IntrinsicTypeMismatch(Box<IntrinsicTypeMismatchError>),
ImportRequiresStringLiteral,
ModuleNotFound {
path: String,
candidates: Vec<String>,
},
StdLibNotFound,
PrivateMemberAccess {
item_kind: String,
name: String,
},
UnknownModuleMember {
module_name: String,
member_name: String,
},
LiteralOutOfRange {
value: u64,
ty: String,
},
CannotNegateUnsigned(String),
ChainedComparison,
IndexOnNonArray {
found: String,
},
ArrayLengthMismatch {
expected: u64,
found: u64,
},
IndexOutOfBounds {
index: i64,
length: u64,
},
TypeAnnotationRequired,
MoveOutOfIndex {
element_type: String,
},
LinkError(String),
UnsupportedTarget(String),
PreviewFeatureRequired {
feature: PreviewFeature,
what: String,
},
ComptimeEvaluationFailed {
reason: String,
},
ComptimeArgNotConst {
param_name: String,
},
ComptimeUserError(String),
InternalError(String),
InternalCodegenError(String),
}Expand description
The kind of compilation error.
Variants§
UnexpectedCharacter(char)
InvalidInteger
InvalidFloat
InvalidStringEscape(char)
UnterminatedString
UnexpectedToken
UnexpectedEof
ParseError(String)
A custom parse error with a specific message.
Used for parser-generated errors that don’t fit the “expected X, found Y” pattern.
NoMainFunction
UndefinedVariable(String)
UndefinedFunction(String)
AssignToImmutable(String)
UnknownType(String)
UseAfterMove(String)
Use of a value after it has been moved.
CannotMoveField
Attempt to move a non-copy field out of a struct (banned by ADR-0036).
TypeMismatch
WrongArgumentCount
MissingFields(Box<MissingFieldsError>)
UnknownField
DuplicateField
MissingFieldInDestructure
Missing field in struct destructuring pattern
EmptyStruct
Anonymous struct with no fields is not allowed
EmptyAnonEnum
Anonymous enum with no variants is not allowed
CopyStructNonCopyField(Box<CopyStructNonCopyFieldError>)
@copy struct contains a field with non-Copy type
ReservedTypeName
User-defined type collides with a built-in type name
DuplicateTypeDefinition
Duplicate type definition
LinearValueNotConsumed(String)
Linear value was not consumed before going out of scope
LinearStructCopy(String)
Linear struct cannot be marked @copy
HandleStructMissingMethod
@handle struct missing required .handle() method
HandleMethodWrongSignature
@handle struct’s .handle() method has wrong signature
DuplicateMethod
Duplicate method definition in impl blocks for the same type
UndefinedMethod
Method not found on a type
UndefinedAssocFn
Associated function not found on a type
MethodCallOnNonStruct
Method call on non-struct type
MethodCalledAsAssocFn
Calling a method (with self) as an associated function
AssocFnCalledAsMethod
Calling an associated function (without self) as a method
DuplicateDestructor
Duplicate destructor for the same type
DestructorUnknownType
Destructor for unknown type
DuplicateConstant
Duplicate constant declaration
ConstExprNotSupported
Expression not supported in const context
DuplicateVariant
UnknownVariant
UnknownEnumType(String)
FieldWrongOrder(Box<FieldWrongOrderError>)
FieldAccessOnNonStruct
InvalidAssignmentTarget
InoutNonLvalue
Inout argument is not an lvalue (variable, field, or array element)
InoutExclusiveAccess
Same variable passed to multiple inout parameters in a single call
BorrowNonLvalue
Borrow argument is not an lvalue (variable, field, or array element)
MutateBorrowedValue
Cannot mutate a borrowed value
MoveOutOfBorrow
Cannot move out of a borrowed value
BorrowInoutConflict
Same variable passed to both borrow and inout parameters (law of exclusivity)
InoutKeywordMissing
Argument to inout parameter is missing inout keyword at call site
BorrowKeywordMissing
Argument to borrow parameter is missing borrow keyword at call site
BreakOutsideLoop
BreakInConsumingForLoop
ContinueOutsideLoop
IntrinsicRequiresChecked(String)
UncheckedCallRequiresChecked(String)
NonExhaustiveMatch
EmptyMatch
InvalidMatchType(String)
UnknownIntrinsic(String)
IntrinsicWrongArgCount
IntrinsicTypeMismatch(Box<IntrinsicTypeMismatchError>)
ImportRequiresStringLiteral
ModuleNotFound
StdLibNotFound
PrivateMemberAccess
UnknownModuleMember
LiteralOutOfRange
CannotNegateUnsigned(String)
ChainedComparison
IndexOnNonArray
ArrayLengthMismatch
IndexOutOfBounds
TypeAnnotationRequired
MoveOutOfIndex
Cannot move non-Copy element out of array index position