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
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.
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).
TypeMismatch
WrongArgumentCount
MissingFields(Box<MissingFieldsError>)
UnknownField
PrivateField
ADR-0072: access to a private field of a synthetic builtin struct from outside that builtin’s own methods.
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
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 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).
UnknownMarker
@mark(...) carries a marker name not in BUILTIN_MARKERS (ADR-0083).
MarkerNotApplicable
@mark(...) carries a marker that is not applicable to the host
item kind (ADR-0083).
ConflictingThreadSafetyMarkers
More than one thread-safety marker on the same type (ADR-0084).
At most one of unsend, checked_send, checked_sync is allowed.
SpawnArgNotSend
@spawn(fn, arg) argument has type that is not at least Send
on the trichotomy (ADR-0084).
SpawnReturnNotSend
@spawn(fn, _) return type is not at least Send (ADR-0084).
SpawnArgIsRef
@spawn(fn, arg) argument is a Ref(T) or MutRef(T) —
references are scope-bound and cannot outlive the caller’s frame.
SpawnArgIsLinear
@spawn(fn, arg) argument is a Linear type — linearity is a
per-thread property today.
SpawnFunctionWrongArity
@spawn(fn, _) function has wrong arity. v1 only supports
single-argument workers; tuple-wrap multiple values on the
caller’s side.
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.
DuplicateMethod
Duplicate method definition in impl blocks for the same type
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.
DeriveNotADerive
@derive(N) references a name that is not a derive item.
Fields
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
InvalidInlineDrop
Inline fn __drop(self) is invalid on this type (wrong signature, @derive(Copy),
linear, etc). ADR-0053.
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
ReferenceEscapesFunction
Reference (Ref(T) / MutRef(T)) escapes the function in which it
was constructed (ADR-0062).
BreakOutsideLoop
BreakInConsumingForLoop
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).
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
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
LinkError(String)
UnsupportedTarget(String)
PreviewFeatureRequired
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
ComptimeArgNotConst
ComptimeUserError(String)
InvalidLangItem
@lang(...) problem (ADR-0079): unknown lang-item name, wrong
argument shape, duplicate binding, or use outside the prelude.
InternalError(String)
InternalCodegenError(String)
Implementations§
Trait Implementations§
§impl Error for ErrorKind
impl Error for ErrorKind
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
impl Eq for ErrorKind
impl StructuralPartialEq for ErrorKind
Auto Trait Implementations§
impl Freeze for ErrorKind
impl RefUnwindSafe for ErrorKind
impl Send for ErrorKind
impl Sync for ErrorKind
impl Unpin for ErrorKind
impl UnsafeUnpin for ErrorKind
impl UnwindSafe for ErrorKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 Twhere
T: 'src,
impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
§type Iter<'a> = Once<&'a T>
where
T: 'a
type Iter<'a> = Once<&'a T> where T: 'a
§fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
§fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
MaybeRef].