ErrorKind

Enum ErrorKind 

Source
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

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.

§

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
§

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

§

CopyStructNonCopyField(Box<CopyStructNonCopyFieldError>)

@copy struct contains a field with non-Copy type

§

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 be marked @copy

§

HandleStructMissingMethod

@handle struct missing required .handle() method

Fields

§struct_name: String
§

HandleMethodWrongSignature

@handle struct’s .handle() method has wrong signature

Fields

§struct_name: String
§found_signature: String
§

DuplicateMethod

Duplicate method definition in impl blocks for the same type

Fields

§type_name: String
§method_name: String
§

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
§

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

§

BreakOutsideLoop

§

BreakInConsumingForLoop

Fields

§element_type: String
§

ContinueOutsideLoop

§

IntrinsicRequiresChecked(String)

§

UncheckedCallRequiresChecked(String)

§

NonExhaustiveMatch

§

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
§

ComptimeEvaluationFailed

Fields

§reason: String
§

ComptimeArgNotConst

Fields

§param_name: String
§

ComptimeUserError(String)

§

InternalError(String)

§

InternalCodegenError(String)

Implementations§

Source§

impl ErrorKind

Source

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§

Source§

impl Clone for ErrorKind

Source§

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
Source§

impl Debug for ErrorKind

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for ErrorKind

Source§

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

Formats the value using the given formatter. Read more
Source§

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
Source§

impl PartialEq for ErrorKind

Source§

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.
Source§

impl Eq for ErrorKind

Source§

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,