Skip to main content

ErrorKind

Enum ErrorKind 

pub enum ErrorKind {
Show 114 variants UnexpectedCharacter(char), InvalidInteger, InvalidFloat, InvalidStringEscape(char), UnterminatedString, EmptyCharLit, UnterminatedCharLit, MultiCharLit, InvalidCharEscape, InvalidUnicodeEscape, UnexpectedToken { expected: Cow<'static, str>, found: Cow<'static, str>, }, UnexpectedEof { expected: Cow<'static, str>, }, ParseError(String), CFfi(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, }, PrivateField { struct_name: String, field_name: String, }, DuplicateField { struct_name: String, field_name: String, }, MissingFieldInDestructure { struct_name: String, field: String, }, EmptyStruct, EmptyAnonEnum, ReservedTypeName { type_name: String, }, DuplicateTypeDefinition { type_name: String, }, LinearValueNotConsumed(String), LinearStructCopy(String), LinearStructClone(String), CloneStructNonCopyField(Box<CloneStructNonCopyFieldError>), PostureMismatch(Box<PostureMismatchError>), UnknownDirective { name: String, note: Option<String>, }, UnknownMarker { name: String, note: Option<String>, }, MarkerNotApplicable { marker: String, item_kind: &'static str, }, ConflictingThreadSafetyMarkers { type_name: String, }, SpawnArgNotSend { arg_type: String, }, SpawnReturnNotSend { fn_name: String, ret_type: String, }, SpawnArgIsRef { arg_type: String, }, SpawnArgIsLinear { arg_type: String, }, SpawnFunctionWrongArity { fn_name: String, arity: usize, }, SpawnFunctionNotFound { name: String, }, DuplicateMethod { type_name: String, method_name: String, }, DeriveDirectFieldAccess { derive_name: String, method_name: String, }, DeriveNotADerive { name: String, found: 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, }, InvalidInlineDrop { type_name: String, reason: 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, ReferenceEscapesFunction { type_name: String, }, BreakOutsideLoop, BreakInConsumingForLoop { element_type: String, }, ContinueOutsideLoop, IntrinsicRequiresChecked(String), UncheckedCallRequiresChecked(String), UncheckedDestructor, ExternFnMissingUnchecked { fn_name: String, library: String, }, InterfaceMethodUncheckedMismatch(Box<InterfaceMethodUncheckedMismatchError>), NonExhaustiveMatch { missing: Vec<String>, }, 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, }, InterfaceMethodMissing(Box<InterfaceMethodMissingData>), InterfaceMethodSignatureMismatch(Box<InterfaceMethodSignatureMismatchData>), RefutablePatternInLet, ComptimeEvaluationFailed { reason: String, }, ComptimeArgNotConst { param_name: String, }, ComptimeUserError(String), InvalidLangItem { reason: String, }, InternalError(String), InternalCodegenError(String),
}
Expand description

The kind of compilation error.

Variants§

§

UnexpectedCharacter(char)

§

InvalidInteger

§

InvalidFloat

§

InvalidStringEscape(char)

§

UnterminatedString

§

EmptyCharLit

ADR-0071: empty char literal ('').

§

UnterminatedCharLit

ADR-0071: char literal not closed before end of line or end of file.

§

MultiCharLit

ADR-0071: char literal contains more than one Unicode scalar.

§

InvalidCharEscape

ADR-0071: invalid escape sequence inside a char literal.

§

InvalidUnicodeEscape

ADR-0071: \u{...} malformed or value not a valid Unicode scalar.

§

UnexpectedToken

Fields

§expected: Cow<'static, str>
§found: Cow<'static, str>
§

UnexpectedEof

Fields

§expected: Cow<'static, str>
§

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.

§

CFfi(String)

ADR-0085: any C-FFI-related diagnostic that doesn’t have its own specific variant. Holds a free-form message; specific shapes (LinkExternDuplicateImport, FfiTypeNotAllowed, etc.) get dedicated variants as the surface grows.

§

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).

Fields

§type_name: String
§field: String
§

TypeMismatch

Fields

§expected: String
§found: String
§

WrongArgumentCount

Fields

§expected: usize
§found: usize
§

MissingFields(Box<MissingFieldsError>)

§

UnknownField

Fields

§struct_name: String
§field_name: String
§

PrivateField

ADR-0072: access to a private field of a synthetic builtin struct from outside that builtin’s own methods.

Fields

§struct_name: String
§field_name: String
§

DuplicateField

Fields

§struct_name: String
§field_name: String
§

MissingFieldInDestructure

Missing field in struct destructuring pattern

Fields

§struct_name: String
§field: String
§

EmptyStruct

Anonymous struct with no fields is not allowed

§

EmptyAnonEnum

Anonymous enum with no variants is not allowed

§

ReservedTypeName

User-defined type collides with a built-in type name

Fields

§type_name: String
§

DuplicateTypeDefinition

Duplicate type definition

Fields

§type_name: String
§

LinearValueNotConsumed(String)

Linear value was not consumed before going out of scope

§

LinearStructCopy(String)

Linear struct cannot derive Copy

§

LinearStructClone(String)

Linear struct cannot derive Clone (ADR-0065)

§

CloneStructNonCopyField(Box<CloneStructNonCopyFieldError>)

@derive(Clone) v1 limitation: every field must be Copy.

§

PostureMismatch(Box<PostureMismatchError>)

Declared posture is inconsistent with members’ postures (ADR-0080).

§

UnknownDirective

A directive name that is not in the recognized set (ADR-0075). note carries either a near-match suggestion or a retirement pointer (for @handle and @copy).

Fields

§name: String
§

UnknownMarker

@mark(...) carries a marker name not in BUILTIN_MARKERS (ADR-0083).

Fields

§name: String
§

MarkerNotApplicable

@mark(...) carries a marker that is not applicable to the host item kind (ADR-0083).

Fields

§marker: String
§item_kind: &'static str
§

ConflictingThreadSafetyMarkers

More than one thread-safety marker on the same type (ADR-0084). At most one of unsend, checked_send, checked_sync is allowed.

Fields

§type_name: String
§

SpawnArgNotSend

@spawn(fn, arg) argument has type that is not at least Send on the trichotomy (ADR-0084).

Fields

§arg_type: String
§

SpawnReturnNotSend

@spawn(fn, _) return type is not at least Send (ADR-0084).

Fields

§fn_name: String
§ret_type: String
§

SpawnArgIsRef

@spawn(fn, arg) argument is a Ref(T) or MutRef(T) — references are scope-bound and cannot outlive the caller’s frame.

Fields

§arg_type: String
§

SpawnArgIsLinear

@spawn(fn, arg) argument is a Linear type — linearity is a per-thread property today.

Fields

§arg_type: String
§

SpawnFunctionWrongArity

@spawn(fn, _) function has wrong arity. v1 only supports single-argument workers; tuple-wrap multiple values on the caller’s side.

Fields

§fn_name: String
§arity: usize
§

SpawnFunctionNotFound

@spawn(fn, _) function name does not resolve to a top-level function. Methods, anonymous functions, and comptime-bound values are not supported in v1.

Fields

§name: String
§

DuplicateMethod

Duplicate method definition in impl blocks for the same type

Fields

§type_name: String
§method_name: String
§

DeriveDirectFieldAccess

A derive body uses direct field projection (self.field) instead of @field(self, "name"). The host type’s structure is not known at derive-definition time (ADR-0058), so direct projection is rejected.

Fields

§derive_name: String
§method_name: String
§

DeriveNotADerive

@derive(N) references a name that is not a derive item.

Fields

§name: String

The name in the @derive(...) directive.

§found: String

What name actually resolved to (e.g., “struct”, “enum”, “function”, or “unknown name”).

§

UndefinedMethod

Method not found on a type

Fields

§type_name: String
§method_name: String
§

UndefinedAssocFn

Associated function not found on a type

Fields

§type_name: String
§function_name: String
§

MethodCallOnNonStruct

Method call on non-struct type

Fields

§found: String
§method_name: String
§

MethodCalledAsAssocFn

Calling a method (with self) as an associated function

Fields

§type_name: String
§method_name: String
§

AssocFnCalledAsMethod

Calling an associated function (without self) as a method

Fields

§type_name: String
§function_name: String
§

DuplicateDestructor

Duplicate destructor for the same type

Fields

§type_name: String
§

DestructorUnknownType

Destructor for unknown type

Fields

§type_name: String
§

InvalidInlineDrop

Inline fn __drop(self) is invalid on this type (wrong signature, @derive(Copy), linear, etc). ADR-0053.

Fields

§type_name: String
§reason: String
§

DuplicateConstant

Duplicate constant declaration

Fields

§name: String
§kind: String
§

ConstExprNotSupported

Expression not supported in const context

Fields

§expr_kind: String
§

DuplicateVariant

Fields

§enum_name: String
§variant_name: String
§

UnknownVariant

Fields

§enum_name: String
§variant_name: String
§

UnknownEnumType(String)

§

FieldWrongOrder(Box<FieldWrongOrderError>)

§

FieldAccessOnNonStruct

Fields

§found: String
§

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

Fields

§variable: String
§

BorrowNonLvalue

Borrow argument is not an lvalue (variable, field, or array element)

§

MutateBorrowedValue

Cannot mutate a borrowed value

Fields

§variable: String
§

MoveOutOfBorrow

Cannot move out of a borrowed value

Fields

§variable: String
§

BorrowInoutConflict

Same variable passed to both borrow and inout parameters (law of exclusivity)

Fields

§variable: String
§

InoutKeywordMissing

Argument to inout parameter is missing inout keyword at call site

§

BorrowKeywordMissing

Argument to borrow parameter is missing borrow keyword at call site

§

ReferenceEscapesFunction

Reference (Ref(T) / MutRef(T)) escapes the function in which it was constructed (ADR-0062).

Fields

§type_name: String
§

BreakOutsideLoop

§

BreakInConsumingForLoop

Fields

§element_type: String
§

ContinueOutsideLoop

§

IntrinsicRequiresChecked(String)

§

UncheckedCallRequiresChecked(String)

§

UncheckedDestructor

ADR-0088: drop glue runs implicitly at scope exit; there is no caller checked { } to gate it, so @mark(unchecked) fn __drop is forbidden.

§

ExternFnMissingUnchecked

ADR-0088: an FFI import inside link_extern / static_link_extern must carry @mark(unchecked).

Fields

§fn_name: String
§library: String
§

InterfaceMethodUncheckedMismatch(Box<InterfaceMethodUncheckedMismatchError>)

ADR-0088: implementor’s is_unchecked flag on a method does not match the interface signature’s. Conformance is strict — a checked interface method may not be satisfied by an @mark(unchecked) impl, and vice versa.

§

NonExhaustiveMatch

Fields

§missing: Vec<String>
§

EmptyMatch

§

InvalidMatchType(String)

§

UnknownIntrinsic(String)

§

IntrinsicWrongArgCount

Fields

§name: String
§expected: usize
§found: usize
§

IntrinsicTypeMismatch(Box<IntrinsicTypeMismatchError>)

§

ImportRequiresStringLiteral

§

ModuleNotFound

Fields

§path: String
§candidates: Vec<String>

Candidates that were tried (for error message)

§

StdLibNotFound

§

PrivateMemberAccess

Fields

§item_kind: String
§name: String
§

UnknownModuleMember

Fields

§module_name: String
§member_name: String
§

LiteralOutOfRange

Fields

§value: u64
§

CannotNegateUnsigned(String)

§

ChainedComparison

§

IndexOnNonArray

Fields

§found: String
§

ArrayLengthMismatch

Fields

§expected: u64
§found: u64
§

IndexOutOfBounds

Fields

§index: i64
§length: u64
§

TypeAnnotationRequired

§

MoveOutOfIndex

Cannot move non-Copy element out of array index position

Fields

§element_type: String
§

LinkError(String)

§

UnsupportedTarget(String)

§

PreviewFeatureRequired

Fields

§what: String
§

InterfaceMethodMissing(Box<InterfaceMethodMissingData>)

Type does not provide a method required by an interface.

§

InterfaceMethodSignatureMismatch(Box<InterfaceMethodSignatureMismatchData>)

Type provides a method but with a signature that does not match the interface requirement.

§

RefutablePatternInLet

§

ComptimeEvaluationFailed

Fields

§reason: String
§

ComptimeArgNotConst

Fields

§param_name: String
§

ComptimeUserError(String)

§

InvalidLangItem

@lang(...) problem (ADR-0079): unknown lang-item name, wrong argument shape, duplicate binding, or use outside the prelude.

Fields

§reason: String
§

InternalError(String)

§

InternalCodegenError(String)

Implementations§

§

impl ErrorKind

pub fn code(&self) -> ErrorCode

Get the error code for this error kind.

Every error kind has a unique, stable error code that can be used for documentation lookup and searchability.

Trait Implementations§

§

impl Clone for ErrorKind

§

fn clone(&self) -> ErrorKind

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for ErrorKind

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Display for ErrorKind

§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Error for ErrorKind

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
§

impl PartialEq for ErrorKind

§

fn eq(&self, other: &ErrorKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Eq for ErrorKind

§

impl StructuralPartialEq for ErrorKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<'src, T> IntoMaybe<'src, T> for T
where T: 'src,

§

type Proj<U: 'src> = U

§

fn map_maybe<R>( self, _f: impl FnOnce(&'src T) -> &'src R, g: impl FnOnce(T) -> R, ) -> <T as IntoMaybe<'src, T>>::Proj<R>
where R: 'src,

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<'p, T> Seq<'p, T> for T
where T: Clone,

§

type Item<'a> = &'a T where T: 'a

The item yielded by the iterator.
§

type Iter<'a> = Once<&'a T> where T: 'a

An iterator over the items within this container, by reference.
§

fn seq_iter(&self) -> <T as Seq<'p, T>>::Iter<'_>

Iterate over the elements of the container.
§

fn contains(&self, val: &T) -> bool
where T: PartialEq,

Check whether an item is contained within this sequence.
§

fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>
where 'p: 'b,

Convert an item of the sequence into a [MaybeRef].
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> OrderedSeq<'_, T> for T
where T: Clone,