Enum sway_core::error::CompileError[][src]

pub enum CompileError<'sc> {
Show 105 variants UnknownVariable { var_name: String, span: Span<'sc>, }, UnknownVariablePath { var_name: &'sc str, span: Span<'sc>, }, UnknownFunction { name: &'sc str, span: Span<'sc>, }, NotAVariable { name: String, span: Span<'sc>, what_it_is: &'static str, }, NotAFunction { name: String, span: Span<'sc>, what_it_is: &'static str, }, Unimplemented(&'static strSpan<'sc>), PatternMatchingAlgorithmFailure(&'static strSpan<'sc>), TypeError(TypeError<'sc>), ParseFailure { span: Span<'sc>, err: Error<Rule>, }, InvalidTopLevelItem(RuleSpan<'sc>), Internal(&'static strSpan<'sc>), UnimplementedRule(RuleSpan<'sc>), InvalidByteLiteralLength { byte_length: usize, span: Span<'sc>, }, ExpectedExprAfterOp { op: &'sc str, span: Span<'sc>, }, ExpectedOp { op: &'sc str, span: Span<'sc>, }, UnexpectedWhereClause(Span<'sc>), UndeclaredGenericTypeInWhereClause { type_name: &'sc str, span: Span<'sc>, }, MultipleContracts(Span<'sc>), MultipleScripts(Span<'sc>), MultiplePredicates(Span<'sc>), ConstrainedNonExistentType { trait_name: &'sc str, type_name: &'sc str, span: Span<'sc>, }, MultiplePredicateMainFunctions(Span<'sc>), NoPredicateMainFunction(Span<'sc>), PredicateMainDoesNotReturnBool(Span<'sc>), NoScriptMainFunction(Span<'sc>), MultipleScriptMainFunctions(Span<'sc>), ReassignmentToNonVariable { name: &'sc str, kind: &'sc str, span: Span<'sc>, }, AssignmentToNonMutable(StringSpan<'sc>), TypeParameterNotInTypeScope { name: String, span: Span<'sc>, comma_separated_generic_params: String, fn_name: &'sc str, args: String, }, MultipleImmediates(Span<'sc>), MismatchedTypeInTrait { span: Span<'sc>, given: String, expected: String, }, NotATrait { span: Span<'sc>, name: &'sc str, }, UnknownTrait { span: Span<'sc>, name: &'sc str, }, FunctionNotAPartOfInterfaceSurface { name: &'sc str, trait_name: String, span: Span<'sc>, }, MissingInterfaceSurfaceMethods { missing_functions: String, span: Span<'sc>, }, IncorrectNumberOfTypeArguments { given: usize, expected: usize, span: Span<'sc>, }, StructNotFound { name: &'sc str, span: Span<'sc>, }, DeclaredNonStructAsStruct { name: &'sc str, span: Span<'sc>, }, AccessedFieldOfNonStruct { field_name: &'sc str, name: &'sc str, span: Span<'sc>, }, MethodOnNonValue { name: &'sc str, thing: &'sc str, span: Span<'sc>, }, StructMissingField { field_name: &'sc str, struct_name: &'sc str, span: Span<'sc>, }, StructDoesNotHaveField { field_name: &'sc str, struct_name: &'sc str, span: Span<'sc>, }, MethodNotFound { span: Span<'sc>, method_name: String, type_name: String, }, NonFinalAsteriskInPath { span: Span<'sc>, }, ModuleNotFound { span: Span<'sc>, name: String, }, NotAStruct { name: String, span: Span<'sc>, actually: String, }, NotAnEnum { name: String, span: Span<'sc>, actually: String, }, FieldNotFound { field_name: &'sc str, available_fields: String, struct_name: String, span: Span<'sc>, }, SymbolNotFound { span: Span<'sc>, name: String, }, ImportPrivateSymbol { span: Span<'sc>, name: String, }, NoElseBranch { span: Span<'sc>, type: String, }, UnqualifiedSelfType { span: Span<'sc>, }, NotAType { span: Span<'sc>, name: String, actually_is: &'sc str, }, MissingEnumInstantiator { span: Span<'sc>, }, PathDoesNotReturn { span: Span<'sc>, ty: String, function_name: &'sc str, }, ExpectedImplicitReturnFromBlockWithType { span: Span<'sc>, ty: String, }, ExpectedImplicitReturnFromBlock { span: Span<'sc>, }, UnknownRegister { span: Span<'sc>, initialized_registers: String, }, MissingImmediate { span: Span<'sc>, }, InvalidImmediateValue { span: Span<'sc>, }, InvalidAssemblyMismatchedReturn { span: Span<'sc>, }, UnknownEnumVariant { enum_name: &'sc str, variant_name: &'sc str, span: Span<'sc>, }, UnrecognizedOp { op_name: &'sc str, span: Span<'sc>, }, TypeMustBeKnown { ty: String, span: Span<'sc>, }, Immediate06TooLarge { val: u64, span: Span<'sc>, }, Immediate12TooLarge { val: u64, span: Span<'sc>, }, Immediate18TooLarge { val: u64, span: Span<'sc>, }, Immediate24TooLarge { val: u64, span: Span<'sc>, }, DisallowedJnei { span: Span<'sc>, }, DisallowedJi { span: Span<'sc>, }, DisallowedLw { span: Span<'sc>, }, IncorrectNumberOfAsmRegisters { span: Span<'sc>, expected: usize, received: usize, }, UnnecessaryImmediate { span: Span<'sc>, }, AmbiguousPath { span: Span<'sc>, }, InvalidStrType { raw: String, span: Span<'sc>, }, UnknownType { span: Span<'sc>, }, TooManyInstructions { span: Span<'sc>, }, FileNotFound { span: Span<'sc>, file_path: String, }, FileCouldNotBeRead { span: Span<'sc>, file_path: String, stringified_error: String, }, ImportMustBeLibrary { span: Span<'sc>, }, MoreThanOneEnumInstantiator { span: Span<'sc>, ty: String, }, UnnecessaryEnumInstantiator { span: Span<'sc>, }, TraitNotFound { name: &'sc str, span: Span<'sc>, }, InvalidExpressionOnLhs { span: Span<'sc>, }, TooManyArgumentsForFunction { span: Span<'sc>, method_name: &'sc str, expected: usize, received: usize, }, TooFewArgumentsForFunction { span: Span<'sc>, method_name: &'sc str, expected: usize, received: usize, }, InvalidAbiType { span: Span<'sc>, }, InvalidNumberOfAbiParams { span: Span<'sc>, }, NotAnAbi { span: Span<'sc>, actually_is: &'static str, }, ImplAbiForNonContract { span: Span<'sc>, ty: String, }, IncorrectNumberOfInterfaceSurfaceFunctionParameters { fn_name: &'sc str, trait_name: &'sc str, num_args: usize, provided_args: usize, span: Span<'sc>, }, AbiFunctionRequiresSpecificSignature { span: Span<'sc>, }, ArgumentParameterTypeMismatch { span: Span<'sc>, should_be: String, provided: String, }, RecursiveCall { fn_name: &'sc str, span: Span<'sc>, }, RecursiveCallChain { fn_name: &'sc str, call_chain: String, span: Span<'sc>, }, TypeWithUnknownSize { span: Span<'sc>, }, InfiniteDependencies { file_path: String, span: Span<'sc>, }, GMFromExternalContract { span: Span<'sc>, }, MintFromExternalContext { span: Span<'sc>, }, BurnFromExternalContext { span: Span<'sc>, }, ContractStorageFromExternalContext { span: Span<'sc>, }, ArrayOutOfBounds { index: u64, count: u64, span: Span<'sc>, }, MatchWrongType { expected: usize, span: Span<'sc>, }, PureCalledImpure { span: Span<'sc>, }, ImpureInNonContract { span: Span<'sc>, },
}

Variants

UnknownVariable

Fields

var_name: String
span: Span<'sc>

UnknownVariablePath

Fields

var_name: &'sc str
span: Span<'sc>

UnknownFunction

Fields

name: &'sc str
span: Span<'sc>

NotAVariable

Fields

name: String
span: Span<'sc>
what_it_is: &'static str

NotAFunction

Fields

name: String
span: Span<'sc>
what_it_is: &'static str

Unimplemented(&'static strSpan<'sc>)

Tuple Fields

0: &'static str
1: Span<'sc>

PatternMatchingAlgorithmFailure(&'static strSpan<'sc>)

Tuple Fields

0: &'static str
1: Span<'sc>

TypeError(TypeError<'sc>)

Tuple Fields

0: TypeError<'sc>

ParseFailure

Fields

span: Span<'sc>
err: Error<Rule>

InvalidTopLevelItem(RuleSpan<'sc>)

Tuple Fields

0: Rule
1: Span<'sc>

Internal(&'static strSpan<'sc>)

Tuple Fields

0: &'static str
1: Span<'sc>

UnimplementedRule(RuleSpan<'sc>)

Tuple Fields

0: Rule
1: Span<'sc>

InvalidByteLiteralLength

Fields

byte_length: usize
span: Span<'sc>

ExpectedExprAfterOp

Fields

op: &'sc str
span: Span<'sc>

ExpectedOp

Fields

op: &'sc str
span: Span<'sc>

UnexpectedWhereClause(Span<'sc>)

Tuple Fields

0: Span<'sc>

UndeclaredGenericTypeInWhereClause

Fields

type_name: &'sc str
span: Span<'sc>

MultipleContracts(Span<'sc>)

Tuple Fields

0: Span<'sc>

MultipleScripts(Span<'sc>)

Tuple Fields

0: Span<'sc>

MultiplePredicates(Span<'sc>)

Tuple Fields

0: Span<'sc>

ConstrainedNonExistentType

Fields

trait_name: &'sc str
type_name: &'sc str
span: Span<'sc>

MultiplePredicateMainFunctions(Span<'sc>)

Tuple Fields

0: Span<'sc>

NoPredicateMainFunction(Span<'sc>)

Tuple Fields

0: Span<'sc>

PredicateMainDoesNotReturnBool(Span<'sc>)

Tuple Fields

0: Span<'sc>

NoScriptMainFunction(Span<'sc>)

Tuple Fields

0: Span<'sc>

MultipleScriptMainFunctions(Span<'sc>)

Tuple Fields

0: Span<'sc>

ReassignmentToNonVariable

Fields

name: &'sc str
kind: &'sc str
span: Span<'sc>

AssignmentToNonMutable(StringSpan<'sc>)

Tuple Fields

0: String
1: Span<'sc>

TypeParameterNotInTypeScope

Fields

name: String
span: Span<'sc>
comma_separated_generic_params: String
fn_name: &'sc str
args: String

MultipleImmediates(Span<'sc>)

Tuple Fields

0: Span<'sc>

MismatchedTypeInTrait

Fields

span: Span<'sc>
given: String
expected: String

NotATrait

Fields

span: Span<'sc>
name: &'sc str

UnknownTrait

Fields

span: Span<'sc>
name: &'sc str

FunctionNotAPartOfInterfaceSurface

Fields

name: &'sc str
trait_name: String
span: Span<'sc>

MissingInterfaceSurfaceMethods

Fields

missing_functions: String
span: Span<'sc>

IncorrectNumberOfTypeArguments

Fields

given: usize
expected: usize
span: Span<'sc>

StructNotFound

Fields

name: &'sc str
span: Span<'sc>

DeclaredNonStructAsStruct

Fields

name: &'sc str
span: Span<'sc>

AccessedFieldOfNonStruct

Fields

field_name: &'sc str
name: &'sc str
span: Span<'sc>

MethodOnNonValue

Fields

name: &'sc str
thing: &'sc str
span: Span<'sc>

StructMissingField

Fields

field_name: &'sc str
struct_name: &'sc str
span: Span<'sc>

StructDoesNotHaveField

Fields

field_name: &'sc str
struct_name: &'sc str
span: Span<'sc>

MethodNotFound

Fields

span: Span<'sc>
method_name: String
type_name: String

NonFinalAsteriskInPath

Fields

span: Span<'sc>

ModuleNotFound

Fields

span: Span<'sc>
name: String

NotAStruct

Fields

name: String
span: Span<'sc>
actually: String

NotAnEnum

Fields

name: String
span: Span<'sc>
actually: String

FieldNotFound

Fields

field_name: &'sc str
available_fields: String
struct_name: String
span: Span<'sc>

SymbolNotFound

Fields

span: Span<'sc>
name: String

ImportPrivateSymbol

Fields

span: Span<'sc>
name: String

NoElseBranch

Fields

span: Span<'sc>
type: String

UnqualifiedSelfType

Fields

span: Span<'sc>

NotAType

Fields

span: Span<'sc>
name: String
actually_is: &'sc str

MissingEnumInstantiator

Fields

span: Span<'sc>

PathDoesNotReturn

Fields

span: Span<'sc>
ty: String
function_name: &'sc str

ExpectedImplicitReturnFromBlockWithType

Fields

span: Span<'sc>
ty: String

ExpectedImplicitReturnFromBlock

Fields

span: Span<'sc>

UnknownRegister

Fields

span: Span<'sc>
initialized_registers: String

MissingImmediate

Fields

span: Span<'sc>

InvalidImmediateValue

Fields

span: Span<'sc>

InvalidAssemblyMismatchedReturn

Fields

span: Span<'sc>

UnknownEnumVariant

Fields

enum_name: &'sc str
variant_name: &'sc str
span: Span<'sc>

UnrecognizedOp

Fields

op_name: &'sc str
span: Span<'sc>

TypeMustBeKnown

Fields

ty: String
span: Span<'sc>

Immediate06TooLarge

Fields

val: u64
span: Span<'sc>

Immediate12TooLarge

Fields

val: u64
span: Span<'sc>

Immediate18TooLarge

Fields

val: u64
span: Span<'sc>

Immediate24TooLarge

Fields

val: u64
span: Span<'sc>

DisallowedJnei

Fields

span: Span<'sc>

DisallowedJi

Fields

span: Span<'sc>

DisallowedLw

Fields

span: Span<'sc>

IncorrectNumberOfAsmRegisters

Fields

span: Span<'sc>
expected: usize
received: usize

UnnecessaryImmediate

Fields

span: Span<'sc>

AmbiguousPath

Fields

span: Span<'sc>

InvalidStrType

Fields

raw: String
span: Span<'sc>

UnknownType

Fields

span: Span<'sc>

TooManyInstructions

Fields

span: Span<'sc>

FileNotFound

Fields

span: Span<'sc>
file_path: String

FileCouldNotBeRead

Fields

span: Span<'sc>
file_path: String
stringified_error: String

ImportMustBeLibrary

Fields

span: Span<'sc>

MoreThanOneEnumInstantiator

Fields

span: Span<'sc>
ty: String

UnnecessaryEnumInstantiator

Fields

span: Span<'sc>

TraitNotFound

Fields

name: &'sc str
span: Span<'sc>

InvalidExpressionOnLhs

Fields

span: Span<'sc>

TooManyArgumentsForFunction

Fields

span: Span<'sc>
method_name: &'sc str
expected: usize
received: usize

TooFewArgumentsForFunction

Fields

span: Span<'sc>
method_name: &'sc str
expected: usize
received: usize

InvalidAbiType

Fields

span: Span<'sc>

InvalidNumberOfAbiParams

Fields

span: Span<'sc>

NotAnAbi

Fields

span: Span<'sc>
actually_is: &'static str

ImplAbiForNonContract

Fields

span: Span<'sc>
ty: String

IncorrectNumberOfInterfaceSurfaceFunctionParameters

Fields

fn_name: &'sc str
trait_name: &'sc str
num_args: usize
provided_args: usize
span: Span<'sc>

AbiFunctionRequiresSpecificSignature

Fields

span: Span<'sc>

ArgumentParameterTypeMismatch

Fields

span: Span<'sc>
should_be: String
provided: String

RecursiveCall

Fields

fn_name: &'sc str
span: Span<'sc>

RecursiveCallChain

Fields

fn_name: &'sc str
call_chain: String
span: Span<'sc>

TypeWithUnknownSize

Fields

span: Span<'sc>

InfiniteDependencies

Fields

file_path: String
span: Span<'sc>

GMFromExternalContract

Fields

span: Span<'sc>

MintFromExternalContext

Fields

span: Span<'sc>

BurnFromExternalContext

Fields

span: Span<'sc>

ContractStorageFromExternalContext

Fields

span: Span<'sc>

ArrayOutOfBounds

Fields

index: u64
count: u64
span: Span<'sc>

MatchWrongType

Fields

expected: usize
span: Span<'sc>

PureCalledImpure

Fields

span: Span<'sc>

ImpureInNonContract

Fields

span: Span<'sc>

Implementations

Returns the line and column start and end

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The lower-level source of this error, if any. Read more

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.