Enum sway_error::error::CompileError

source ·
pub enum CompileError {
Show 191 variants ModuleDepGraphEvaluationError {}, ModuleDepGraphCyclicReference { modules: Vec<BaseIdent>, }, UnknownVariable { var_name: Ident, span: Span, }, NotAVariable { name: Ident, what_it_is: &'static str, span: Span, }, Unimplemented { feature: String, help: Vec<String>, span: Span, }, TypeError(TypeError), ParseError { span: Span, err: String, }, Internal(&'static str, Span), InternalOwned(String, Span), NoPredicateMainFunction(Span), PredicateMainDoesNotReturnBool(Span), NoScriptMainFunction(Span), MultipleDefinitionsOfFallbackFunction { name: Ident, span: Span, }, MultipleDefinitionsOfFunction { name: Ident, span: Span, }, MultipleDefinitionsOfName { name: Ident, span: Span, }, MultipleDefinitionsOfConstant { name: Ident, span: Span, }, MultipleDefinitionsOfType { name: Ident, span: Span, }, MultipleDefinitionsOfMatchArmVariable { match_value: Span, match_type: String, first_definition: Span, first_definition_is_struct_field: bool, duplicate: Span, duplicate_is_struct_field: bool, }, AssignmentToNonMutableVariable { decl_name: Ident, lhs_span: Span, }, AssignmentToConstantOrConfigurable { decl_name: Ident, is_configurable: bool, lhs_span: Span, }, DeclAssignmentTargetCannotBeAssignedTo { decl_name: Option<Ident>, decl_friendly_type_name: &'static str, lhs_span: Span, }, AssignmentViaNonMutableReference { decl_reference_name: Option<Ident>, decl_reference_rhs: Option<Span>, decl_reference_type: String, span: Span, }, MethodRequiresMutableSelf { method_name: Ident, variable_name: Ident, span: Span, }, MutableParameterNotSupported { param_name: Ident, span: Span, }, ImmutableArgumentToMutableParameter { span: Span, }, RefMutableNotAllowedInContractAbi { param_name: Ident, span: Span, }, RefMutCannotReferenceConstant { constant: String, span: Span, }, RefMutCannotReferenceImmutableVariable { decl_name: Ident, span: Span, }, AssociatedFunctionCalledAsMethod { fn_name: Ident, span: Span, }, TypeParameterNotInTypeScope { name: Ident, span: Span, comma_separated_generic_params: String, fn_name: Ident, args: String, }, MismatchedTypeInInterfaceSurface { interface_name: InterfaceName, span: Span, decl_type: String, given: String, expected: String, }, UnknownTrait { span: Span, name: Ident, }, FunctionNotAPartOfInterfaceSurface { name: Ident, interface_name: InterfaceName, span: Span, }, ConstantNotAPartOfInterfaceSurface { name: Ident, interface_name: InterfaceName, span: Span, }, TypeNotAPartOfInterfaceSurface { name: Ident, interface_name: InterfaceName, span: Span, }, MissingInterfaceSurfaceConstants { missing_constants: Vec<BaseIdent>, span: Span, }, MissingInterfaceSurfaceTypes { missing_types: Vec<BaseIdent>, span: Span, }, MissingInterfaceSurfaceMethods { missing_functions: Vec<BaseIdent>, span: Span, }, IncorrectNumberOfTypeArguments { name: Ident, given: usize, expected: usize, span: Span, }, DoesNotTakeTypeArguments { name: Ident, span: Span, }, DoesNotTakeTypeArgumentsAsPrefix { name: Ident, span: Span, }, TypeArgumentsNotAllowed { span: Span, }, NeedsTypeArguments { name: Ident, span: Span, }, EnumNotFound { name: Ident, span: Span, }, StructInstantiationMissingFieldForErrorRecovery { field_name: Ident, struct_name: Ident, span: Span, }, StructInstantiationMissingFields { field_names: Vec<Ident>, struct_name: Ident, span: Span, struct_decl_span: Span, total_number_of_fields: usize, }, StructCannotBeInstantiated { struct_name: Ident, span: Span, struct_decl_span: Span, private_fields: Vec<Ident>, constructors: Vec<String>, all_fields_are_private: bool, is_in_storage_declaration: bool, struct_can_be_changed: bool, }, StructFieldIsPrivate { field_name: IdentUnique, struct_name: Ident, field_decl_span: Span, struct_can_be_changed: bool, usage_context: StructFieldUsageContext, }, StructFieldDoesNotExist { field_name: IdentUnique, available_fields: Vec<Ident>, is_public_struct_access: bool, struct_name: Ident, struct_decl_span: Span, struct_is_empty: bool, usage_context: StructFieldUsageContext, }, MethodNotFound { method_name: Ident, type_name: String, span: Span, }, ModuleNotFound { span: Span, name: String, }, FieldAccessOnNonStruct { actually: String, storage_variable: Option<String>, field_name: IdentUnique, span: Span, }, TupleElementAccessOnNonTuple { actually: String, span: Span, index: usize, index_span: Span, }, NotIndexable { actually: String, span: Span, }, 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, }, DeclIsNotStorage { actually: String, span: Span, }, DeclIsNotAConstant { actually: String, span: Span, }, DeclIsNotATypeAlias { actually: String, span: Span, }, SymbolNotFound { name: Ident, span: Span, }, ImportPrivateSymbol { name: Ident, span: Span, }, ImportPrivateModule { name: Ident, span: Span, }, NoElseBranch { span: Span, type: String, }, NotAType { span: Span, name: String, actually_is: &'static str, }, MissingEnumInstantiator { span: Span, }, PathDoesNotReturn { span: Span, ty: String, function_name: Ident, }, ExpectedModuleDocComment { span: Span, }, UnknownRegister { span: Span, initialized_registers: String, }, MissingImmediate { span: Span, }, InvalidImmediateValue { 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, }, TraitConstraintNotSatisfied { type_id: usize, ty: String, trait_name: String, span: Span, }, TraitConstraintMissing { param: String, trait_name: String, span: Span, }, Immediate06TooLarge { val: u64, span: Span, }, Immediate12TooLarge { val: u64, span: Span, }, Immediate18TooLarge { val: u64, span: Span, }, Immediate24TooLarge { val: u64, span: Span, }, IncorrectNumberOfAsmRegisters { span: Span, expected: usize, received: usize, }, UnnecessaryImmediate { span: Span, }, AmbiguousPath { span: Span, }, ModulePathIsNotAnExpression { module_path: String, span: Span, }, UnknownType { span: Span, }, UnknownTypeName { name: String, span: Span, }, FileCouldNotBeRead { span: Span, file_path: String, stringified_error: String, }, ImportMustBeLibrary { span: Span, }, MoreThanOneEnumInstantiator { span: Span, ty: String, }, UnnecessaryEnumInstantiator { span: Span, }, UnitVariantWithParenthesesEnumInstantiator { span: Span, ty: String, }, TraitNotFound { name: String, span: Span, }, TraitNotImportedAtFunctionApplication { trait_name: String, function_name: String, function_call_site_span: Span, trait_constraint_span: Span, trait_candidates: Vec<String>, }, InvalidExpressionOnLhs { span: Span, }, CannotBeEvaluatedToConst { span: Span, }, TooManyArgumentsForFunction { span: Span, method_name: Ident, dot_syntax_used: bool, expected: usize, received: usize, }, TooFewArgumentsForFunction { span: Span, method_name: Ident, dot_syntax_used: bool, expected: usize, received: usize, }, MissingParenthesesForFunction { span: Span, method_name: Ident, }, InvalidAbiType { span: Span, }, NotAnAbi { span: Span, actually_is: &'static str, }, ImplAbiForNonContract { span: Span, ty: String, }, ConflictingImplsForTraitAndType { trait_name: String, type_implementing_for: String, existing_impl_span: Span, second_impl_span: Span, }, DuplicateDeclDefinedForType { decl_kind: String, decl_name: String, type_implementing_for: String, span: Span, }, IncorrectNumberOfInterfaceSurfaceFunctionParameters { fn_name: Ident, interface_name: InterfaceName, 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, }, GMFromExternalContext { span: Span, }, MintFromExternalContext { span: Span, }, BurnFromExternalContext { span: Span, }, ContractStorageFromExternalContext { span: Span, }, InvalidOpcodeFromPredicate { opcode: String, span: Span, }, ArrayOutOfBounds { index: u64, count: u64, span: Span, }, TupleIndexOutOfBounds { index: usize, count: usize, tuple_type: String, span: Span, prefix_span: Span, }, ConstantsCannotBeShadowed { variable_or_constant: String, name: IdentUnique, constant_span: Span, constant_decl: Span, is_alias: bool, }, ConstantShadowsVariable { name: IdentUnique, variable_span: Span, }, ShadowsOtherSymbol { name: IdentUnique, }, GenericShadowsGeneric { name: IdentUnique, }, MatchExpressionNonExhaustive { missing_patterns: String, span: Span, }, MatchStructPatternMissingFields { missing_fields: Vec<Ident>, missing_fields_are_public: bool, struct_name: Ident, struct_decl_span: Span, total_number_of_fields: usize, span: Span, }, MatchStructPatternMustIgnorePrivateFields { private_fields: Vec<Ident>, struct_name: Ident, struct_decl_span: Span, all_fields_are_private: bool, span: Span, }, MatchArmVariableNotDefinedInAllAlternatives { match_value: Span, match_type: String, variable: Ident, missing_in_alternatives: Vec<Span>, }, MatchArmVariableMismatchedType { match_value: Span, match_type: String, variable: Ident, first_definition: Span, expected: String, received: String, }, MatchedValueIsNotValid { supported_types_message: Vec<&'static str>, span: Span, }, StorageAccessMismatch { attrs: String, span: Span, }, TraitDeclPureImplImpure { fn_name: Ident, interface_name: InterfaceName, attrs: String, span: Span, }, TraitImplPurityMismatch { fn_name: Ident, interface_name: InterfaceName, attrs: String, span: Span, }, ImpureInNonContract { span: Span, }, ImpureInPureContext { storage_op: &'static str, attrs: String, span: Span, }, ParameterRefMutabilityMismatch { span: Span, }, IntegerTooLarge { span: Span, ty: String, }, IntegerTooSmall { span: Span, ty: String, }, IntegerContainsInvalidDigit { span: Span, ty: String, }, AbiAsSupertrait { span: Span, }, SupertraitImplRequired { supertrait_name: String, trait_name: Ident, span: Span, }, ContractCallParamRepeated { param_name: String, span: Span, }, UnrecognizedContractParam { param_name: String, span: Span, }, CallParamForNonContractCallMethod { span: Span, }, StorageFieldDoesNotExist { field_name: IdentUnique, available_fields: Vec<Ident>, storage_decl_span: Span, }, NoDeclaredStorage { span: Span, }, MultipleStorageDeclarations { span: Span, }, InvalidStorageOnlyTypeDecl { ty: String, span: Span, }, UnexpectedDeclaration { decl_type: &'static str, span: Span, }, ContractAddressMustBeKnown { span: Span, }, ConvertParseTree { error: ConvertParseTreeError, }, Lex { error: LexError, }, Parse { error: ParseError, }, NonConstantDeclValue { span: Span, }, StorageDeclarationInNonContract { program_kind: String, span: Span, }, IntrinsicUnsupportedArgType { name: String, span: Span, hint: String, }, IntrinsicIncorrectNumArgs { name: String, expected: u64, span: Span, }, IntrinsicIncorrectNumTArgs { name: String, expected: u64, span: Span, }, ExpectedStringLiteral { span: Span, }, BreakOutsideLoop { span: Span, }, ContinueOutsideLoop { span: Span, }, ContractIdConstantNotAConstDecl { span: Span, }, ContractIdValueNotALiteral { span: Span, }, TypeNotAllowed { reason: TypeNotAllowedReason, span: Span, }, RefMutableNotAllowedInMain { param_name: Ident, span: Span, }, InitializedRegisterReassignment { name: String, span: Span, }, DisallowedControlFlowInstruction { name: String, span: Span, }, CallingPrivateLibraryMethod { name: String, span: Span, }, DisallowedIntrinsicInPredicate { intrinsic: String, span: Span, }, CoinsPassedToNonPayableMethod { fn_name: Ident, span: Span, }, TraitImplPayabilityMismatch { fn_name: Ident, interface_name: InterfaceName, missing_impl_attribute: bool, span: Span, }, ConfigurableInLibrary { span: Span, }, MultipleApplicableItemsInScope { span: Span, type_name: String, item_name: String, item_kind: String, as_traits: Vec<String>, }, NonStrGenericType { span: Span, }, ContractCallsItsOwnMethod { span: Span, }, AbiShadowsSuperAbiMethod { span: Span, superabi: Ident, }, ConflictingSuperAbiMethods { span: Span, method_name: String, superabi1: String, superabi2: String, }, AssociatedTypeNotSupportedInAbi { span: Span, }, AbiSupertraitMethodCallAsContractCall { fn_name: Ident, span: Span, }, TypeIsNotValidAsImplementingFor { invalid_type: InvalidImplementingForType, trait_name: Option<String>, span: Span, }, UninitRegisterInAsmBlockBeingRead { span: Span, }, ExpressionCannotBeDereferenced { expression_type: String, span: Span, }, FallbackFnsAreContractOnly { span: Span, }, FallbackFnsCannotHaveParameters { span: Span, }, CouldNotGenerateEntry { span: Span, }, CouldNotGenerateEntryMissingCore { span: Span, }, CouldNotGenerateEntryMissingImpl { ty: String, span: Span, },
}

Variants§

§

ModuleDepGraphEvaluationError

§

ModuleDepGraphCyclicReference

Fields

§modules: Vec<BaseIdent>
§

UnknownVariable

Fields

§var_name: Ident
§span: Span
§

NotAVariable

Fields

§name: Ident
§what_it_is: &'static str
§span: Span
§

Unimplemented

Fields

§feature: String

The description of the unimplemented feature, formulated in a way that fits into common ending “is currently not implemented.” E.g., “Using something”.

§help: Vec<String>

Help lines. Empty if there is no additional help. To get an empty line between the help lines, insert a String containing only a space: " ".to_string().

§span: Span
§

TypeError(TypeError)

§

ParseError

Fields

§span: Span
§

Internal(&'static str, Span)

§

InternalOwned(String, Span)

§

NoPredicateMainFunction(Span)

§

PredicateMainDoesNotReturnBool(Span)

§

NoScriptMainFunction(Span)

§

MultipleDefinitionsOfFallbackFunction

Fields

§name: Ident
§span: Span
§

MultipleDefinitionsOfFunction

Fields

§name: Ident
§span: Span
§

MultipleDefinitionsOfName

Fields

§name: Ident
§span: Span
§

MultipleDefinitionsOfConstant

Fields

§name: Ident
§span: Span
§

MultipleDefinitionsOfType

Fields

§name: Ident
§span: Span
§

MultipleDefinitionsOfMatchArmVariable

Fields

§match_value: Span
§match_type: String
§first_definition: Span
§first_definition_is_struct_field: bool
§duplicate: Span
§duplicate_is_struct_field: bool
§

AssignmentToNonMutableVariable

Fields

§decl_name: Ident

Variable name pointing to the name in the variable declaration.

§lhs_span: Span

The complete left-hand side of the assignment.

§

AssignmentToConstantOrConfigurable

Fields

§decl_name: Ident

Constant or configurable name pointing to the name in the constant declaration.

§is_configurable: bool
§lhs_span: Span

The complete left-hand side of the assignment.

§

DeclAssignmentTargetCannotBeAssignedTo

Fields

§decl_name: Option<Ident>

Name of the declared variant, pointing to the name in the declaration.

§decl_friendly_type_name: &'static str

Friendly name of the type of the declaration. E.g., “function”, or “struct”.

§lhs_span: Span

The complete left-hand side of the assignment.

§

AssignmentViaNonMutableReference

Fields

§decl_reference_name: Option<Ident>

Name of the reference, if the left-hand side of the assignment is a reference variable, pointing to the name in the reference variable declaration.

None if the assignment LHS is an arbitrary expression and not a variable.

§decl_reference_rhs: Option<Span>

Span of the right-hand side of the reference variable definition, if the left-hand side of the assignment is a reference variable.

§decl_reference_type: String

The type of the reference, if the left-hand side of the assignment is a reference variable, expected to start with &.

§span: Span
§

MethodRequiresMutableSelf

Fields

§method_name: Ident
§variable_name: Ident
§span: Span
§

MutableParameterNotSupported

Fields

§param_name: Ident
§span: Span
§

ImmutableArgumentToMutableParameter

Fields

§span: Span
§

RefMutableNotAllowedInContractAbi

Fields

§param_name: Ident
§span: Span
§

RefMutCannotReferenceConstant

Fields

§constant: String

Constant, as accessed in code. E.g.:

  • MY_CONST
  • LIB_CONST_ALIAS
  • ::lib::module::SOME_CONST
§span: Span
§

RefMutCannotReferenceImmutableVariable

Fields

§decl_name: Ident

Variable name pointing to the name in the variable declaration.

§span: Span
§

AssociatedFunctionCalledAsMethod

Fields

§fn_name: Ident
§span: Span
§

TypeParameterNotInTypeScope

Fields

§name: Ident
§span: Span
§comma_separated_generic_params: String
§fn_name: Ident
§args: String
§

MismatchedTypeInInterfaceSurface

Fields

§interface_name: InterfaceName
§span: Span
§decl_type: String
§given: String
§expected: String
§

UnknownTrait

Fields

§span: Span
§name: Ident
§

FunctionNotAPartOfInterfaceSurface

Fields

§name: Ident
§interface_name: InterfaceName
§span: Span
§

ConstantNotAPartOfInterfaceSurface

Fields

§name: Ident
§interface_name: InterfaceName
§span: Span
§

TypeNotAPartOfInterfaceSurface

Fields

§name: Ident
§interface_name: InterfaceName
§span: Span
§

MissingInterfaceSurfaceConstants

Fields

§missing_constants: Vec<BaseIdent>
§span: Span
§

MissingInterfaceSurfaceTypes

Fields

§missing_types: Vec<BaseIdent>
§span: Span
§

MissingInterfaceSurfaceMethods

Fields

§missing_functions: Vec<BaseIdent>
§span: Span
§

IncorrectNumberOfTypeArguments

Fields

§name: Ident
§given: usize
§expected: usize
§span: Span
§

DoesNotTakeTypeArguments

Fields

§name: Ident
§span: Span
§

DoesNotTakeTypeArgumentsAsPrefix

Fields

§name: Ident
§span: Span
§

TypeArgumentsNotAllowed

Fields

§span: Span
§

NeedsTypeArguments

Fields

§name: Ident
§span: Span
§

EnumNotFound

Fields

§name: Ident
§span: Span
§

StructInstantiationMissingFieldForErrorRecovery

This error is used only for error recovery and is not emitted as a compiler error to the final compilation output. The compiler emits the cumulative error CompileError::StructInstantiationMissingFields given below, and that one also only if the struct can actually be instantiated.

Fields

§field_name: Ident
§struct_name: Ident

Original, non-aliased struct name.

§span: Span
§

StructInstantiationMissingFields

Fields

§field_names: Vec<Ident>
§struct_name: Ident

Original, non-aliased struct name.

§span: Span
§struct_decl_span: Span
§total_number_of_fields: usize
§

StructCannotBeInstantiated

Fields

§struct_name: Ident

Original, non-aliased struct name.

§span: Span
§struct_decl_span: Span
§private_fields: Vec<Ident>
§constructors: Vec<String>

All available public constructors if is_in_storage_declaration is false, or only the public constructors that potentially evaluate to a constant if is_in_storage_declaration is true.

§all_fields_are_private: bool

True if the struct has only private fields.

§is_in_storage_declaration: bool
§struct_can_be_changed: bool
§

StructFieldIsPrivate

Fields

§field_name: IdentUnique
§struct_name: Ident

Original, non-aliased struct name.

§field_decl_span: Span
§struct_can_be_changed: bool
§

StructFieldDoesNotExist

Fields

§field_name: IdentUnique
§available_fields: Vec<Ident>

Only public fields if is_public_struct_access is true.

§is_public_struct_access: bool
§struct_name: Ident

Original, non-aliased struct name.

§struct_decl_span: Span
§struct_is_empty: bool
§

MethodNotFound

Fields

§method_name: Ident
§type_name: String
§span: Span
§

ModuleNotFound

Fields

§span: Span
§name: String
§

FieldAccessOnNonStruct

Fields

§actually: String
§storage_variable: Option<String>

Name of the storage variable, if the field access happens within the access to a storage variable.

§field_name: IdentUnique

Name of the field that is tried to be accessed.

§span: Span
§

TupleElementAccessOnNonTuple

Fields

§actually: String
§span: Span
§index: usize
§index_span: Span
§

NotIndexable

Fields

§actually: String
§span: Span
§

NotAnEnum

Fields

§name: String
§span: Span
§actually: String
§

NotAStruct

Fields

§span: Span
§actually: String
§

DeclIsNotAnEnum

Fields

§actually: String
§span: Span
§

DeclIsNotAStruct

Fields

§actually: String
§span: Span
§

DeclIsNotAFunction

Fields

§actually: String
§span: Span
§

DeclIsNotAVariable

Fields

§actually: String
§span: Span
§

DeclIsNotAnAbi

Fields

§actually: String
§span: Span
§

DeclIsNotATrait

Fields

§actually: String
§span: Span
§

DeclIsNotAnImplTrait

Fields

§actually: String
§span: Span
§

DeclIsNotATraitFn

Fields

§actually: String
§span: Span
§

DeclIsNotStorage

Fields

§actually: String
§span: Span
§

DeclIsNotAConstant

Fields

§actually: String
§span: Span
§

DeclIsNotATypeAlias

Fields

§actually: String
§span: Span
§

SymbolNotFound

Fields

§name: Ident
§span: Span
§

ImportPrivateSymbol

Fields

§name: Ident
§span: Span
§

ImportPrivateModule

Fields

§name: Ident
§span: Span
§

NoElseBranch

Fields

§span: Span
§type: String
§

NotAType

Fields

§span: Span
§name: String
§actually_is: &'static str
§

MissingEnumInstantiator

Fields

§span: Span
§

PathDoesNotReturn

Fields

§span: Span
§function_name: Ident
§

ExpectedModuleDocComment

Fields

§span: Span
§

UnknownRegister

Fields

§span: Span
§initialized_registers: String
§

MissingImmediate

Fields

§span: Span
§

InvalidImmediateValue

Fields

§span: Span
§

UnknownEnumVariant

Fields

§enum_name: Ident
§variant_name: Ident
§span: Span
§

UnrecognizedOp

Fields

§op_name: Ident
§span: Span
§

UnableToInferGeneric

Fields

§span: Span
§

UnconstrainedGenericParameter

Fields

§span: Span
§

TraitConstraintNotSatisfied

Fields

§type_id: usize
§trait_name: String
§span: Span
§

TraitConstraintMissing

Fields

§param: String
§trait_name: String
§span: Span
§

Immediate06TooLarge

Fields

§val: u64
§span: Span
§

Immediate12TooLarge

Fields

§val: u64
§span: Span
§

Immediate18TooLarge

Fields

§val: u64
§span: Span
§

Immediate24TooLarge

Fields

§val: u64
§span: Span
§

IncorrectNumberOfAsmRegisters

Fields

§span: Span
§expected: usize
§received: usize
§

UnnecessaryImmediate

Fields

§span: Span
§

AmbiguousPath

Fields

§span: Span
§

ModulePathIsNotAnExpression

Fields

§module_path: String
§span: Span
§

UnknownType

Fields

§span: Span
§

UnknownTypeName

Fields

§name: String
§span: Span
§

FileCouldNotBeRead

Fields

§span: Span
§file_path: String
§stringified_error: String
§

ImportMustBeLibrary

Fields

§span: Span
§

MoreThanOneEnumInstantiator

Fields

§span: Span
§

UnnecessaryEnumInstantiator

Fields

§span: Span
§

UnitVariantWithParenthesesEnumInstantiator

Fields

§span: Span
§

TraitNotFound

Fields

§name: String
§span: Span
§

TraitNotImportedAtFunctionApplication

Fields

§trait_name: String
§function_name: String
§function_call_site_span: Span
§trait_constraint_span: Span
§trait_candidates: Vec<String>
§

InvalidExpressionOnLhs

Fields

§span: Span
§

CannotBeEvaluatedToConst

Fields

§span: Span
§

TooManyArgumentsForFunction

Fields

§span: Span
§method_name: Ident
§dot_syntax_used: bool
§expected: usize
§received: usize
§

TooFewArgumentsForFunction

Fields

§span: Span
§method_name: Ident
§dot_syntax_used: bool
§expected: usize
§received: usize
§

MissingParenthesesForFunction

Fields

§span: Span
§method_name: Ident
§

InvalidAbiType

Fields

§span: Span
§

NotAnAbi

Fields

§span: Span
§actually_is: &'static str
§

ImplAbiForNonContract

Fields

§span: Span
§

ConflictingImplsForTraitAndType

Fields

§trait_name: String
§type_implementing_for: String
§existing_impl_span: Span
§second_impl_span: Span
§

DuplicateDeclDefinedForType

Fields

§decl_kind: String
§decl_name: String
§type_implementing_for: String
§span: Span
§

IncorrectNumberOfInterfaceSurfaceFunctionParameters

Fields

§fn_name: Ident
§interface_name: InterfaceName
§num_parameters: usize
§provided_parameters: usize
§span: Span
§

ArgumentParameterTypeMismatch

Fields

§span: Span
§should_be: String
§provided: String
§

RecursiveCall

Fields

§fn_name: Ident
§span: Span
§

RecursiveCallChain

Fields

§fn_name: Ident
§call_chain: String
§span: Span
§

RecursiveType

Fields

§name: Ident
§span: Span
§

RecursiveTypeChain

Fields

§name: Ident
§type_chain: String
§span: Span
§

GMFromExternalContext

Fields

§span: Span
§

MintFromExternalContext

Fields

§span: Span
§

BurnFromExternalContext

Fields

§span: Span
§

ContractStorageFromExternalContext

Fields

§span: Span
§

InvalidOpcodeFromPredicate

Fields

§opcode: String
§span: Span
§

ArrayOutOfBounds

Fields

§index: u64
§count: u64
§span: Span
§

TupleIndexOutOfBounds

Fields

§index: usize
§count: usize
§tuple_type: String
§span: Span
§prefix_span: Span
§

ConstantsCannotBeShadowed

Fields

§variable_or_constant: String
§constant_span: Span
§constant_decl: Span
§is_alias: bool
§

ConstantShadowsVariable

Fields

§variable_span: Span
§

ShadowsOtherSymbol

Fields

§

GenericShadowsGeneric

Fields

§

MatchExpressionNonExhaustive

Fields

§missing_patterns: String
§span: Span
§

MatchStructPatternMissingFields

Fields

§missing_fields: Vec<Ident>
§missing_fields_are_public: bool
§struct_name: Ident

Original, non-aliased struct name.

§struct_decl_span: Span
§total_number_of_fields: usize
§span: Span
§

MatchStructPatternMustIgnorePrivateFields

Fields

§private_fields: Vec<Ident>
§struct_name: Ident

Original, non-aliased struct name.

§struct_decl_span: Span
§all_fields_are_private: bool
§span: Span
§

MatchArmVariableNotDefinedInAllAlternatives

Fields

§match_value: Span
§match_type: String
§variable: Ident
§missing_in_alternatives: Vec<Span>
§

MatchArmVariableMismatchedType

Fields

§match_value: Span
§match_type: String
§variable: Ident
§first_definition: Span
§expected: String
§received: String
§

MatchedValueIsNotValid

Fields

§supported_types_message: Vec<&'static str>

Common message describing which Sway types are currently supported in match expressions.

§span: Span
§

StorageAccessMismatch

Fields

§attrs: String
§span: Span
§

TraitDeclPureImplImpure

Fields

§fn_name: Ident
§interface_name: InterfaceName
§attrs: String
§span: Span
§

TraitImplPurityMismatch

Fields

§fn_name: Ident
§interface_name: InterfaceName
§attrs: String
§span: Span
§

ImpureInNonContract

Fields

§span: Span
§

ImpureInPureContext

Fields

§storage_op: &'static str
§attrs: String
§span: Span
§

ParameterRefMutabilityMismatch

Fields

§span: Span
§

IntegerTooLarge

Fields

§span: Span
§

IntegerTooSmall

Fields

§span: Span
§

IntegerContainsInvalidDigit

Fields

§span: Span
§

AbiAsSupertrait

Fields

§span: Span
§

SupertraitImplRequired

Fields

§supertrait_name: String
§trait_name: Ident
§span: Span
§

ContractCallParamRepeated

Fields

§param_name: String
§span: Span
§

UnrecognizedContractParam

Fields

§param_name: String
§span: Span
§

CallParamForNonContractCallMethod

Fields

§span: Span
§

StorageFieldDoesNotExist

Fields

§field_name: IdentUnique
§available_fields: Vec<Ident>
§storage_decl_span: Span
§

NoDeclaredStorage

Fields

§span: Span
§

MultipleStorageDeclarations

Fields

§span: Span
§

InvalidStorageOnlyTypeDecl

Fields

§span: Span
§

UnexpectedDeclaration

Fields

§decl_type: &'static str
§span: Span
§

ContractAddressMustBeKnown

Fields

§span: Span
§

ConvertParseTree

§

Lex

Fields

§error: LexError
§

Parse

Fields

§

NonConstantDeclValue

Fields

§span: Span
§

StorageDeclarationInNonContract

Fields

§program_kind: String
§span: Span
§

IntrinsicUnsupportedArgType

Fields

§name: String
§span: Span
§hint: String
§

IntrinsicIncorrectNumArgs

Fields

§name: String
§expected: u64
§span: Span
§

IntrinsicIncorrectNumTArgs

Fields

§name: String
§expected: u64
§span: Span
§

ExpectedStringLiteral

Fields

§span: Span
§

BreakOutsideLoop

Fields

§span: Span
§

ContinueOutsideLoop

Fields

§span: Span
§

ContractIdConstantNotAConstDecl

This will be removed once loading contract IDs in a dependency namespace is refactored and no longer manual: https://github.com/FuelLabs/sway/issues/3077

Fields

§span: Span
§

ContractIdValueNotALiteral

This will be removed once loading contract IDs in a dependency namespace is refactored and no longer manual: https://github.com/FuelLabs/sway/issues/3077

Fields

§span: Span
§

TypeNotAllowed

Fields

§span: Span
§

RefMutableNotAllowedInMain

Fields

§param_name: Ident
§span: Span
§

InitializedRegisterReassignment

Fields

§name: String
§span: Span
§

DisallowedControlFlowInstruction

Fields

§name: String
§span: Span
§

CallingPrivateLibraryMethod

Fields

§name: String
§span: Span
§

DisallowedIntrinsicInPredicate

Fields

§intrinsic: String
§span: Span
§

CoinsPassedToNonPayableMethod

Fields

§fn_name: Ident
§span: Span
§

TraitImplPayabilityMismatch

Fields

§fn_name: Ident
§interface_name: InterfaceName
§missing_impl_attribute: bool
§span: Span
§

ConfigurableInLibrary

Fields

§span: Span
§

MultipleApplicableItemsInScope

Fields

§span: Span
§type_name: String
§item_name: String
§item_kind: String
§as_traits: Vec<String>
§

NonStrGenericType

Fields

§span: Span
§

ContractCallsItsOwnMethod

Fields

§span: Span
§

AbiShadowsSuperAbiMethod

Fields

§span: Span
§superabi: Ident
§

ConflictingSuperAbiMethods

Fields

§span: Span
§method_name: String
§superabi1: String
§superabi2: String
§

AssociatedTypeNotSupportedInAbi

Fields

§span: Span
§

AbiSupertraitMethodCallAsContractCall

Fields

§fn_name: Ident
§span: Span
§

TypeIsNotValidAsImplementingFor

Fields

§trait_name: Option<String>

Name of the trait if the impl implements a trait, None otherwise.

§span: Span
§

UninitRegisterInAsmBlockBeingRead

Fields

§span: Span
§

ExpressionCannotBeDereferenced

Fields

§expression_type: String
§span: Span
§

FallbackFnsAreContractOnly

Fields

§span: Span
§

FallbackFnsCannotHaveParameters

Fields

§span: Span
§

CouldNotGenerateEntry

Fields

§span: Span
§

CouldNotGenerateEntryMissingCore

Fields

§span: Span
§

CouldNotGenerateEntryMissingImpl

Fields

§span: Span

Trait Implementations§

source§

impl Clone for CompileError

source§

fn clone(&self) -> CompileError

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for CompileError

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for CompileError

source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Error for CompileError

source§

fn source(&self) -> Option<&(dyn Error + 'static)>

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

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
source§

impl From<ConvertParseTreeError> for CompileError

source§

fn from(source: ConvertParseTreeError) -> Self

Converts to this type from the input type.
source§

impl From<TypeError> for CompileError

source§

fn from(other: TypeError) -> CompileError

Converts to this type from the input type.
source§

impl Hash for CompileError

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

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

impl PartialEq for CompileError

source§

fn eq(&self, other: &CompileError) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Spanned for CompileError

source§

fn span(&self) -> Span

source§

impl ToDiagnostic for CompileError

source§

fn to_diagnostic(&self, source_engine: &SourceEngine) -> Diagnostic

source§

impl Eq for CompileError

source§

impl StructuralPartialEq for CompileError

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Conv for T

source§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> FmtForward for T

source§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
source§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
source§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
source§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
source§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
source§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
source§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
source§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
source§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T> Pipe for T
where T: ?Sized,

source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
source§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
source§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
source§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
source§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
source§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
source§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
source§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
source§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> StorageAsMut for T

source§

fn storage<Type>(&mut self) -> StorageMut<'_, Self, Type>
where Type: Mappable,

source§

fn storage_as_mut<Type>(&mut self) -> StorageMut<'_, Self, Type>
where Type: Mappable,

source§

impl<T> StorageAsRef for T

source§

fn storage<Type>(&self) -> StorageRef<'_, Self, Type>
where Type: Mappable,

source§

fn storage_as_ref<Type>(&self) -> StorageRef<'_, Self, Type>
where Type: Mappable,

source§

impl<T> Tap for T

source§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
source§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
source§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
source§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
source§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
source§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
source§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
source§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
source§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
source§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
source§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
source§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
source§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
source§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
source§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
source§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T> TryConv for T

source§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V