Enum sway_core::error::CompileError
source · [−]pub enum CompileError {
Show 161 variants
UnknownVariable {
var_name: Ident,
},
UnknownVariablePath {
var_name: Ident,
span: Span,
},
UnknownFunction {
name: Ident,
span: Span,
},
NotAVariable {
name: Ident,
what_it_is: &'static str,
},
NotAFunction {
name: CallPath,
what_it_is: &'static str,
},
Unimplemented(&'static str, Span),
TypeError(TypeError),
ParseError {
span: Span,
err: String,
},
Internal(&'static str, Span),
InternalOwned(String, Span),
InvalidByteLiteralLength {
byte_length: usize,
span: Span,
},
ExpectedExprAfterOp {
op: String,
span: Span,
},
ExpectedOp {
op: String,
span: Span,
},
MultipleContracts(Span),
MultipleScripts(Span),
MultiplePredicates(Span),
NoPredicateMainFunction(Span),
PredicateMainDoesNotReturnBool(Span),
NoScriptMainFunction(Span),
MultipleDefinitionsOfFunction {
name: Ident,
},
ReassignmentToNonVariable {
name: Ident,
kind: &'static str,
span: Span,
},
AssignmentToNonMutable {
name: Ident,
},
MethodRequiresMutableSelf {
method_name: Ident,
variable_name: Ident,
span: Span,
},
MutableParameterNotSupported {
param_name: Ident,
},
ImmutableArgumentToMutableParameter {
span: Span,
},
RefMutableNotAllowedInContractAbi {
param_name: Ident,
},
AssociatedFunctionCalledAsMethod {
fn_name: Ident,
span: Span,
},
TypeParameterNotInTypeScope {
name: Ident,
span: Span,
comma_separated_generic_params: String,
fn_name: Ident,
args: String,
},
MultipleImmediates(Span),
MismatchedTypeInTrait {
span: Span,
given: String,
expected: String,
},
NotATrait {
span: Span,
name: Ident,
},
UnknownTrait {
span: Span,
name: Ident,
},
FunctionNotAPartOfInterfaceSurface {
name: Ident,
trait_name: Ident,
span: Span,
},
MissingInterfaceSurfaceMethods {
missing_functions: String,
span: Span,
},
IncorrectNumberOfTypeArguments {
given: usize,
expected: usize,
span: Span,
},
DoesNotTakeTypeArguments {
name: Ident,
span: Span,
},
TypeArgumentsNotAllowed {
span: Span,
},
NeedsTypeArguments {
name: Ident,
span: Span,
},
StructNotFound {
name: Ident,
span: Span,
},
EnumNotFound {
name: Ident,
span: Span,
},
DeclaredNonStructAsStruct {
name: Ident,
span: Span,
},
AccessedFieldOfNonStruct {
field_name: Ident,
name: Ident,
span: Span,
},
MethodOnNonValue {
name: Ident,
thing: Ident,
span: Span,
},
StructMissingField {
field_name: Ident,
struct_name: Ident,
span: Span,
},
StructDoesNotHaveField {
field_name: Ident,
struct_name: Ident,
span: Span,
},
MethodNotFound {
method_name: Ident,
type_name: String,
},
ModuleNotFound {
span: Span,
name: String,
},
FieldAccessOnNonStruct {
actually: String,
span: Span,
},
NotATuple {
name: String,
span: Span,
actually: String,
},
NotAnEnum {
name: String,
span: Span,
actually: String,
},
NotAStruct {
span: Span,
actually: String,
},
DeclIsNotAnEnum {
actually: String,
span: Span,
},
DeclIsNotAStruct {
actually: String,
span: Span,
},
DeclIsNotAFunction {
actually: String,
span: Span,
},
DeclIsNotAVariable {
actually: String,
span: Span,
},
DeclIsNotAnAbi {
actually: String,
span: Span,
},
DeclIsNotATrait {
actually: String,
span: Span,
},
DeclIsNotAnImplTrait {
actually: String,
span: Span,
},
DeclIsNotATraitFn {
actually: String,
span: Span,
},
FieldNotFound {
field_name: Ident,
available_fields: String,
struct_name: Ident,
},
SymbolNotFound {
name: Ident,
},
ImportPrivateSymbol {
name: Ident,
},
NoElseBranch {
span: Span,
type: String,
},
UnqualifiedSelfType {
span: Span,
},
NotAType {
span: Span,
name: String,
actually_is: &'static str,
},
MissingEnumInstantiator {
span: Span,
},
PathDoesNotReturn {
span: Span,
ty: String,
function_name: Ident,
},
ExpectedImplicitReturnFromBlockWithType {
span: Span,
ty: String,
},
ExpectedImplicitReturnFromBlock {
span: Span,
},
UnknownRegister {
span: Span,
initialized_registers: String,
},
MissingImmediate {
span: Span,
},
InvalidImmediateValue {
span: Span,
},
InvalidAssemblyMismatchedReturn {
span: Span,
},
UnknownEnumVariant {
enum_name: Ident,
variant_name: Ident,
span: Span,
},
UnrecognizedOp {
op_name: Ident,
span: Span,
},
UnableToInferGeneric {
ty: String,
span: Span,
},
UnconstrainedGenericParameter {
ty: String,
span: Span,
},
Immediate06TooLarge {
val: u64,
span: Span,
},
Immediate12TooLarge {
val: u64,
span: Span,
},
Immediate18TooLarge {
val: u64,
span: Span,
},
Immediate24TooLarge {
val: u64,
span: Span,
},
DisallowedJi {
span: Span,
},
DisallowedJnei {
span: Span,
},
DisallowedJnzi {
span: Span,
},
DisallowedLw {
span: Span,
},
IncorrectNumberOfAsmRegisters {
span: Span,
expected: usize,
received: usize,
},
UnnecessaryImmediate {
span: Span,
},
AmbiguousPath {
span: Span,
},
InvalidStrType {
raw: String,
span: Span,
},
UnknownType {
span: Span,
},
UnknownTypeName {
name: String,
span: Span,
},
TooManyInstructions {
span: Span,
},
FileNotFound {
span: Span,
file_path: String,
},
FileCouldNotBeRead {
span: Span,
file_path: String,
stringified_error: String,
},
ImportMustBeLibrary {
span: Span,
},
MoreThanOneEnumInstantiator {
span: Span,
ty: String,
},
UnnecessaryEnumInstantiator {
span: Span,
},
TraitNotFound {
name: CallPath,
},
InvalidExpressionOnLhs {
span: Span,
},
TooManyArgumentsForFunction {
span: Span,
method_name: Ident,
expected: usize,
received: usize,
},
TooFewArgumentsForFunction {
span: Span,
method_name: Ident,
expected: usize,
received: usize,
},
InvalidAbiType {
span: Span,
},
NotAnAbi {
span: Span,
actually_is: &'static str,
},
ImplAbiForNonContract {
span: Span,
ty: String,
},
IncorrectNumberOfInterfaceSurfaceFunctionParameters {
fn_name: Ident,
trait_name: Ident,
num_parameters: usize,
provided_parameters: usize,
span: Span,
},
ArgumentParameterTypeMismatch {
span: Span,
should_be: String,
provided: String,
},
RecursiveCall {
fn_name: Ident,
span: Span,
},
RecursiveCallChain {
fn_name: Ident,
call_chain: String,
span: Span,
},
RecursiveType {
name: Ident,
span: Span,
},
RecursiveTypeChain {
name: Ident,
type_chain: String,
span: Span,
},
TypeWithUnknownSize {
span: Span,
},
InfiniteDependencies {
file_path: String,
span: Span,
},
GMFromExternalContract {
span: Span,
},
MintFromExternalContext {
span: Span,
},
BurnFromExternalContext {
span: Span,
},
ContractStorageFromExternalContext {
span: Span,
},
ArrayOutOfBounds {
index: u64,
count: u64,
span: Span,
},
TupleIndexOutOfBounds {
index: usize,
count: usize,
span: Span,
},
ShadowsOtherSymbol {
name: Ident,
},
GenericShadowsGeneric {
name: Ident,
},
StarImportShadowsOtherSymbol {
name: Ident,
},
MatchWrongType {
expected: TypeId,
span: Span,
},
MatchExpressionNonExhaustive {
missing_patterns: String,
span: Span,
},
MatchStructPatternMissingFields {
missing_fields: Vec<String>,
span: Span,
},
StorageAccessMismatch {
attrs: String,
span: Span,
},
TraitDeclPureImplImpure {
fn_name: Ident,
trait_name: Ident,
attrs: String,
span: Span,
},
TraitImplPurityMismatch {
fn_name: Ident,
trait_name: Ident,
attrs: String,
span: Span,
},
ImpureInNonContract {
span: Span,
},
ImpureInPureContext {
storage_op: &'static str,
attrs: String,
span: Span,
},
IntegerTooLarge {
span: Span,
ty: String,
},
IntegerTooSmall {
span: Span,
ty: String,
},
IntegerContainsInvalidDigit {
span: Span,
ty: String,
},
AsteriskWithAlias {
span: Span,
},
AbiAsSupertrait {
span: Span,
},
SupertraitImplMissing {
supertrait_name: CallPath,
type_name: String,
span: Span,
},
SupertraitImplRequired {
supertrait_name: CallPath,
trait_name: Ident,
span: Span,
},
IfLetNonEnum {
span: Span,
},
ContractCallParamRepeated {
param_name: String,
span: Span,
},
UnrecognizedContractParam {
param_name: String,
span: Span,
},
CallParamForNonContractCallMethod {
span: Span,
},
StorageFieldDoesNotExist {
name: Ident,
},
NoDeclaredStorage {
span: Span,
},
MultipleStorageDeclarations {
span: Span,
},
InvalidStorageOnlyTypeDecl {
ty: String,
span: Span,
},
InvalidVariableName {
name: Ident,
},
UnexpectedDeclaration {
decl_type: &'static str,
span: Span,
},
ContractAddressMustBeKnown {
span: Span,
},
ConvertParseTree {
error: ConvertParseTreeError,
},
Lex {
error: LexError,
},
Parse {
error: ParseError,
},
WhereClauseNotYetSupported {
span: Span,
},
NonConstantDeclValue {
span: Span,
},
StorageDeclarationInNonContract {
program_kind: String,
span: Span,
},
IntrinsicUnsupportedArgType {
name: String,
span: Span,
hint: Hint,
},
IntrinsicIncorrectNumArgs {
name: String,
expected: u64,
span: Span,
},
IntrinsicIncorrectNumTArgs {
name: String,
expected: u64,
span: Span,
},
BreakOutsideLoop {
span: Span,
},
ContinueOutsideLoop {
span: Span,
},
MainArgsNotYetSupported {
span: Span,
},
ConfigTimeConstantNotAConstDecl {
span: Span,
},
ConfigTimeConstantNotALiteral {
span: Span,
},
}
Variants
UnknownVariable
Fields
var_name: Ident
UnknownVariablePath
UnknownFunction
NotAVariable
NotAFunction
Unimplemented(&'static str, Span)
TypeError(TypeError)
ParseError
Internal(&'static str, Span)
InternalOwned(String, Span)
InvalidByteLiteralLength
ExpectedExprAfterOp
ExpectedOp
MultipleContracts(Span)
MultipleScripts(Span)
MultiplePredicates(Span)
NoPredicateMainFunction(Span)
PredicateMainDoesNotReturnBool(Span)
NoScriptMainFunction(Span)
MultipleDefinitionsOfFunction
Fields
name: Ident
ReassignmentToNonVariable
AssignmentToNonMutable
Fields
name: Ident
MethodRequiresMutableSelf
MutableParameterNotSupported
Fields
param_name: Ident
ImmutableArgumentToMutableParameter
Fields
span: Span
RefMutableNotAllowedInContractAbi
Fields
param_name: Ident
AssociatedFunctionCalledAsMethod
TypeParameterNotInTypeScope
MultipleImmediates(Span)
MismatchedTypeInTrait
NotATrait
UnknownTrait
FunctionNotAPartOfInterfaceSurface
MissingInterfaceSurfaceMethods
IncorrectNumberOfTypeArguments
DoesNotTakeTypeArguments
TypeArgumentsNotAllowed
Fields
span: Span
NeedsTypeArguments
StructNotFound
EnumNotFound
DeclaredNonStructAsStruct
AccessedFieldOfNonStruct
MethodOnNonValue
StructMissingField
StructDoesNotHaveField
MethodNotFound
ModuleNotFound
FieldAccessOnNonStruct
NotATuple
NotAnEnum
NotAStruct
DeclIsNotAnEnum
DeclIsNotAStruct
DeclIsNotAFunction
DeclIsNotAVariable
DeclIsNotAnAbi
DeclIsNotATrait
DeclIsNotAnImplTrait
DeclIsNotATraitFn
FieldNotFound
SymbolNotFound
Fields
name: Ident
ImportPrivateSymbol
Fields
name: Ident
NoElseBranch
UnqualifiedSelfType
Fields
span: Span
NotAType
MissingEnumInstantiator
Fields
span: Span
PathDoesNotReturn
ExpectedImplicitReturnFromBlockWithType
ExpectedImplicitReturnFromBlock
Fields
span: Span
UnknownRegister
MissingImmediate
Fields
span: Span
InvalidImmediateValue
Fields
span: Span
InvalidAssemblyMismatchedReturn
Fields
span: Span
UnknownEnumVariant
UnrecognizedOp
UnableToInferGeneric
UnconstrainedGenericParameter
Immediate06TooLarge
Immediate12TooLarge
Immediate18TooLarge
Immediate24TooLarge
DisallowedJi
Fields
span: Span
DisallowedJnei
Fields
span: Span
DisallowedJnzi
Fields
span: Span
DisallowedLw
Fields
span: Span
IncorrectNumberOfAsmRegisters
UnnecessaryImmediate
Fields
span: Span
AmbiguousPath
Fields
span: Span
InvalidStrType
UnknownType
Fields
span: Span
UnknownTypeName
TooManyInstructions
Fields
span: Span
FileNotFound
FileCouldNotBeRead
ImportMustBeLibrary
Fields
span: Span
MoreThanOneEnumInstantiator
UnnecessaryEnumInstantiator
Fields
span: Span
TraitNotFound
Fields
name: CallPath
InvalidExpressionOnLhs
Fields
span: Span
TooManyArgumentsForFunction
TooFewArgumentsForFunction
InvalidAbiType
Fields
span: Span
NotAnAbi
ImplAbiForNonContract
IncorrectNumberOfInterfaceSurfaceFunctionParameters
ArgumentParameterTypeMismatch
RecursiveCall
RecursiveCallChain
RecursiveType
RecursiveTypeChain
TypeWithUnknownSize
Fields
span: Span
InfiniteDependencies
GMFromExternalContract
Fields
span: Span
MintFromExternalContext
Fields
span: Span
BurnFromExternalContext
Fields
span: Span
ContractStorageFromExternalContext
Fields
span: Span
ArrayOutOfBounds
TupleIndexOutOfBounds
ShadowsOtherSymbol
Fields
name: Ident
GenericShadowsGeneric
Fields
name: Ident
StarImportShadowsOtherSymbol
Fields
name: Ident
MatchWrongType
MatchExpressionNonExhaustive
MatchStructPatternMissingFields
StorageAccessMismatch
TraitDeclPureImplImpure
TraitImplPurityMismatch
ImpureInNonContract
Fields
span: Span
ImpureInPureContext
IntegerTooLarge
IntegerTooSmall
IntegerContainsInvalidDigit
AsteriskWithAlias
Fields
span: Span
AbiAsSupertrait
Fields
span: Span
SupertraitImplMissing
SupertraitImplRequired
IfLetNonEnum
Fields
span: Span
ContractCallParamRepeated
UnrecognizedContractParam
CallParamForNonContractCallMethod
Fields
span: Span
StorageFieldDoesNotExist
Fields
name: Ident
NoDeclaredStorage
Fields
span: Span
MultipleStorageDeclarations
Fields
span: Span
InvalidStorageOnlyTypeDecl
InvalidVariableName
Fields
name: Ident
UnexpectedDeclaration
ContractAddressMustBeKnown
Fields
span: Span
ConvertParseTree
Lex
Fields
error: LexError
Parse
Fields
error: ParseError
WhereClauseNotYetSupported
Fields
span: Span
NonConstantDeclValue
Fields
span: Span
StorageDeclarationInNonContract
IntrinsicUnsupportedArgType
IntrinsicIncorrectNumArgs
IntrinsicIncorrectNumTArgs
BreakOutsideLoop
Fields
span: Span
ContinueOutsideLoop
Fields
span: Span
MainArgsNotYetSupported
Fields
span: Span
ConfigTimeConstantNotAConstDecl
Fields
span: Span
ConfigTimeConstantNotALiteral
Fields
span: Span
Implementations
Trait Implementations
sourceimpl Clone for CompileError
impl Clone for CompileError
sourcefn clone(&self) -> CompileError
fn clone(&self) -> CompileError
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for CompileError
impl Debug for CompileError
sourceimpl Display for CompileError
impl Display for CompileError
sourceimpl Error for CompileError
impl Error for CompileError
sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
sourceimpl From<TypeError> for CompileError
impl From<TypeError> for CompileError
sourcefn from(other: TypeError) -> CompileError
fn from(other: TypeError) -> CompileError
Converts to this type from the input type.
sourceimpl Hash for CompileError
impl Hash for CompileError
sourceimpl PartialEq<CompileError> for CompileError
impl PartialEq<CompileError> for CompileError
sourcefn eq(&self, other: &CompileError) -> bool
fn eq(&self, other: &CompileError) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
impl Eq for CompileError
impl StructuralEq for CompileError
impl StructuralPartialEq for CompileError
Auto Trait Implementations
impl RefUnwindSafe for CompileError
impl Send for CompileError
impl Sync for CompileError
impl Unpin for CompileError
impl UnwindSafe for CompileError
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more