Enum sway_core::error::CompileError
source · [−]pub enum CompileError {
Show 118 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),
PatternMatchingAlgorithmFailure(&'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,
},
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,
},
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,
},
TypeMustBeKnown {
ty: String,
span: Span,
},
Immediate06TooLarge {
val: u64,
span: Span,
},
Immediate12TooLarge {
val: u64,
span: Span,
},
Immediate18TooLarge {
val: u64,
span: Span,
},
Immediate24TooLarge {
val: u64,
span: Span,
},
DisallowedJnei {
span: Span,
},
DisallowedJi {
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,
},
InvalidNumberOfAbiParams {
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,
},
AbiFunctionRequiresSpecificSignature {
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,
},
StarImportShadowsOtherSymbol {
name: String,
span: Span,
},
MatchWrongType {
expected: TypeId,
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,
},
}Variants
UnknownVariable
UnknownVariablePath
UnknownFunction
NotAVariable
NotAFunction
Unimplemented(&'static str, Span)
PatternMatchingAlgorithmFailure(&'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
StructNotFound
DeclaredNonStructAsStruct
AccessedFieldOfNonStruct
MethodOnNonValue
StructMissingField
StructDoesNotHaveField
MethodNotFound
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
TypeMustBeKnown
Immediate06TooLarge
Immediate12TooLarge
Immediate18TooLarge
Immediate24TooLarge
DisallowedJnei
Fields
span: SpanDisallowedJi
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: SpanInvalidNumberOfAbiParams
Fields
span: SpanNotAnAbi
ImplAbiForNonContract
IncorrectNumberOfInterfaceSurfaceFunctionParameters
AbiFunctionRequiresSpecificSignature
Fields
span: SpanArgumentParameterTypeMismatch
RecursiveCall
RecursiveCallChain
TypeWithUnknownSize
Fields
span: SpanInfiniteDependencies
GMFromExternalContract
Fields
span: SpanMintFromExternalContext
Fields
span: SpanBurnFromExternalContext
Fields
span: SpanContractStorageFromExternalContext
Fields
span: SpanArrayOutOfBounds
TupleOutOfBounds
ShadowsOtherSymbol
StarImportShadowsOtherSymbol
MatchWrongType
PureCalledImpure
Fields
span: SpanImpureInNonContract
Fields
span: SpanIntegerTooLarge
IntegerTooSmall
IntegerContainsInvalidDigit
AsteriskWithAlias
Fields
span: SpanAbiAsSupertrait
Fields
span: SpanNameDefinedMultipleTimesForTrait
SupertraitImplMissing
SupertraitImplRequired
Implementations
sourceimpl CompileError
impl CompileError
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
1.30.0 · 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
Performs the conversion.
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 · sourcepub fn borrow_mut(&mut self) -> &mut T
pub 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.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub 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