Enum sway_core::error::CompileError
source · [−]pub enum CompileError {
Show 134 variants
UnknownVariable {
var_name: String,
span: Span,
},
UnknownVariablePath {
var_name: Ident,
span: Span,
},
UnknownFunction {
name: Ident,
span: Span,
},
NotAVariable {
name: String,
span: Span,
what_it_is: &'static str,
},
NotAFunction {
name: String,
span: Span,
what_it_is: &'static str,
},
Unimplemented(&'static str, Span),
TypeError(TypeError),
ParseFailure {
span: Span,
err: Error<Rule>,
},
ParseError {
span: Span,
err: String,
},
InvalidTopLevelItem(Rule, Span),
Internal(&'static str, Span),
InternalOwned(String, Span),
UnimplementedRule(Rule, Span),
InvalidByteLiteralLength {
byte_length: usize,
span: Span,
},
ExpectedExprAfterOp {
op: String,
span: Span,
},
ExpectedOp {
op: String,
span: Span,
},
UnexpectedWhereClause(Span),
UndeclaredGenericTypeInWhereClause {
type_name: Ident,
span: Span,
},
MultipleContracts(Span),
MultipleScripts(Span),
MultiplePredicates(Span),
ConstrainedNonExistentType {
trait_name: Ident,
type_name: Ident,
span: Span,
},
MultiplePredicateMainFunctions(Span),
NoPredicateMainFunction(Span),
PredicateMainDoesNotReturnBool(Span),
NoScriptMainFunction(Span),
MultipleScriptMainFunctions(Span),
ReassignmentToNonVariable {
name: Ident,
kind: &'static str,
span: Span,
},
AssignmentToNonMutable(String, Span),
TypeParameterNotInTypeScope {
name: String,
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,
},
NeedsTypeArguments {
name: Ident,
span: Span,
},
StructNotFound {
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 {
span: Span,
method_name: String,
type_name: String,
},
DuplicateMethodDefinitions {
method_name: String,
span: Span,
},
ModuleNotFound {
span: Span,
name: String,
},
NotAStruct {
name: String,
span: Span,
actually: String,
},
NotATuple {
name: String,
span: Span,
actually: String,
},
NotAnEnum {
name: String,
span: Span,
actually: String,
},
FieldNotFound {
field_name: Ident,
available_fields: String,
struct_name: String,
span: Span,
},
SymbolNotFound {
span: Span,
name: String,
},
ImportPrivateSymbol {
span: Span,
name: String,
},
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,
},
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,
},
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: String,
span: Span,
},
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_args: usize,
provided_args: 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,
},
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,
},
TupleOutOfBounds {
index: usize,
count: usize,
span: Span,
},
ShadowsOtherSymbol {
name: String,
span: Span,
},
GenericShadowsGeneric {
name: String,
span: Span,
},
StarImportShadowsOtherSymbol {
name: String,
span: Span,
},
MatchWrongType {
expected: TypeId,
span: Span,
},
MatchExpressionNonExhaustive {
missing_patterns: String,
span: Span,
},
PureCalledImpure {
span: Span,
},
ImpureInNonContract {
span: Span,
},
IntegerTooLarge {
span: Span,
ty: String,
},
IntegerTooSmall {
span: Span,
ty: String,
},
IntegerContainsInvalidDigit {
span: Span,
ty: String,
},
AsteriskWithAlias {
span: Span,
},
AbiAsSupertrait {
span: Span,
},
NameDefinedMultipleTimesForTrait {
fn_name: String,
trait_name: String,
span: Span,
},
SupertraitImplMissing {
supertrait_name: String,
type_name: String,
span: Span,
},
SupertraitImplRequired {
supertrait_name: String,
trait_name: String,
span: Span,
},
IfLetNonEnum {
span: Span,
},
ContractCallParamRepeated {
param_name: String,
span: Span,
},
UnrecognizedContractParam {
param_name: String,
span: Span,
},
CallParamForNonContractCallMethod {
span: Span,
},
StorageFieldDoesNotExist {
name: String,
span: Span,
},
NoDeclaredStorage {
span: Span,
},
MultipleStorageDeclarations {
span: Span,
},
InvalidVariableName {
name: String,
span: Span,
},
UnexpectedDeclaration {
decl_type: &'static str,
span: Span,
},
ContractAddressMustBeKnown {
span: Span,
},
ConvertParseTree {
error: ConvertParseTreeError,
},
Lex {
error: LexError,
},
Parse {
error: ParseError,
},
}Variants
UnknownVariable
UnknownVariablePath
UnknownFunction
NotAVariable
NotAFunction
Unimplemented(&'static str, Span)
TypeError(TypeError)
ParseFailure
ParseError
InvalidTopLevelItem(Rule, Span)
Internal(&'static str, Span)
InternalOwned(String, Span)
UnimplementedRule(Rule, Span)
InvalidByteLiteralLength
ExpectedExprAfterOp
ExpectedOp
UnexpectedWhereClause(Span)
UndeclaredGenericTypeInWhereClause
MultipleContracts(Span)
MultipleScripts(Span)
MultiplePredicates(Span)
ConstrainedNonExistentType
MultiplePredicateMainFunctions(Span)
NoPredicateMainFunction(Span)
PredicateMainDoesNotReturnBool(Span)
NoScriptMainFunction(Span)
MultipleScriptMainFunctions(Span)
ReassignmentToNonVariable
AssignmentToNonMutable(String, Span)
TypeParameterNotInTypeScope
MultipleImmediates(Span)
MismatchedTypeInTrait
NotATrait
UnknownTrait
FunctionNotAPartOfInterfaceSurface
MissingInterfaceSurfaceMethods
IncorrectNumberOfTypeArguments
DoesNotTakeTypeArguments
NeedsTypeArguments
StructNotFound
DeclaredNonStructAsStruct
AccessedFieldOfNonStruct
MethodOnNonValue
StructMissingField
StructDoesNotHaveField
MethodNotFound
DuplicateMethodDefinitions
ModuleNotFound
NotAStruct
NotATuple
NotAnEnum
FieldNotFound
SymbolNotFound
ImportPrivateSymbol
NoElseBranch
UnqualifiedSelfType
Fields
span: SpanNotAType
MissingEnumInstantiator
Fields
span: SpanPathDoesNotReturn
ExpectedImplicitReturnFromBlockWithType
ExpectedImplicitReturnFromBlock
Fields
span: SpanUnknownRegister
MissingImmediate
Fields
span: SpanInvalidImmediateValue
Fields
span: SpanInvalidAssemblyMismatchedReturn
Fields
span: SpanUnknownEnumVariant
UnrecognizedOp
UnableToInferGeneric
Immediate06TooLarge
Immediate12TooLarge
Immediate18TooLarge
Immediate24TooLarge
DisallowedJi
Fields
span: SpanDisallowedJnei
Fields
span: SpanDisallowedJnzi
Fields
span: SpanDisallowedLw
Fields
span: SpanIncorrectNumberOfAsmRegisters
UnnecessaryImmediate
Fields
span: SpanAmbiguousPath
Fields
span: SpanInvalidStrType
UnknownType
Fields
span: SpanTooManyInstructions
Fields
span: SpanFileNotFound
FileCouldNotBeRead
ImportMustBeLibrary
Fields
span: SpanMoreThanOneEnumInstantiator
UnnecessaryEnumInstantiator
Fields
span: SpanTraitNotFound
InvalidExpressionOnLhs
Fields
span: SpanTooManyArgumentsForFunction
TooFewArgumentsForFunction
InvalidAbiType
Fields
span: SpanNotAnAbi
ImplAbiForNonContract
IncorrectNumberOfInterfaceSurfaceFunctionParameters
ArgumentParameterTypeMismatch
RecursiveCall
RecursiveCallChain
TypeWithUnknownSize
Fields
span: SpanInfiniteDependencies
GMFromExternalContract
Fields
span: SpanMintFromExternalContext
Fields
span: SpanBurnFromExternalContext
Fields
span: SpanContractStorageFromExternalContext
Fields
span: SpanArrayOutOfBounds
TupleOutOfBounds
ShadowsOtherSymbol
GenericShadowsGeneric
StarImportShadowsOtherSymbol
MatchWrongType
MatchExpressionNonExhaustive
PureCalledImpure
Fields
span: SpanImpureInNonContract
Fields
span: SpanIntegerTooLarge
IntegerTooSmall
IntegerContainsInvalidDigit
AsteriskWithAlias
Fields
span: SpanAbiAsSupertrait
Fields
span: SpanNameDefinedMultipleTimesForTrait
SupertraitImplMissing
SupertraitImplRequired
IfLetNonEnum
Fields
span: SpanContractCallParamRepeated
UnrecognizedContractParam
CallParamForNonContractCallMethod
Fields
span: SpanStorageFieldDoesNotExist
NoDeclaredStorage
Fields
span: SpanMultipleStorageDeclarations
Fields
span: SpanInvalidVariableName
UnexpectedDeclaration
ContractAddressMustBeKnown
Fields
span: SpanConvertParseTree
Lex
Fields
error: LexErrorParse
Fields
error: ParseErrorImplementations
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
sourcefn backtrace(&self) -> Option<&Backtrace>
fn backtrace(&self) -> Option<&Backtrace>
🔬 This is a nightly-only experimental API. (
backtrace)Returns a stack backtrace, if available, of where this error occurred. 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
sourcefn ne(&self, other: &CompileError) -> bool
fn ne(&self, other: &CompileError) -> bool
This method tests for !=.
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<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more