pub enum CompilerError {
Show 66 variants
InvalidCharacter {
character: char,
span: Span,
},
UnterminatedString {
span: Span,
},
UnterminatedBlockComment {
span: Span,
},
InvalidUnicodeEscape {
value: String,
span: Span,
},
InvalidNumber {
value: String,
span: Span,
},
UnexpectedToken {
expected: String,
found: String,
span: Span,
},
UnexpectedEof {
span: Span,
},
UndefinedReference {
name: String,
span: Span,
},
TypeMismatch {
expected: String,
found: String,
span: Span,
},
DuplicateDefinition {
name: String,
span: Span,
},
ModuleNotFound {
name: String,
span: Span,
},
ModuleReadError {
path: String,
error: String,
span: Span,
},
CircularImport {
cycle: String,
span: Span,
},
PrivateImport {
name: String,
span: Span,
},
ImportItemNotFound {
item: String,
module: String,
available: String,
span: Span,
},
ParseError {
message: String,
span: Span,
},
UndefinedType {
name: String,
span: Span,
},
PrimitiveRedefinition {
name: String,
span: Span,
},
TraitUsedAsValueType {
trait_name: String,
span: Span,
},
UndefinedTrait {
name: String,
span: Span,
},
NotATrait {
name: String,
actual_kind: String,
span: Span,
},
MissingTraitField {
field: String,
trait_name: String,
span: Span,
},
TraitFieldTypeMismatch {
field: String,
trait_name: String,
expected: String,
actual: String,
span: Span,
},
CircularDependency {
cycle: String,
span: Span,
},
InvalidBinaryOp {
op: String,
left_type: String,
right_type: String,
span: Span,
},
ForLoopNotArray {
actual: String,
span: Span,
},
ArrayDestructuringNotArray {
actual: String,
span: Span,
},
StructDestructuringNotStruct {
actual: String,
span: Span,
},
InvalidIfCondition {
actual: String,
span: Span,
},
MatchNotEnum {
actual: String,
span: Span,
},
NonExhaustiveMatch {
missing: String,
span: Span,
},
DuplicateMatchArm {
variant: String,
span: Span,
},
UnknownEnumVariant {
variant: String,
enum_name: String,
span: Span,
},
VariantArityMismatch {
variant: String,
expected: usize,
actual: usize,
span: Span,
},
MissingField {
field: String,
type_name: String,
span: Span,
},
UnknownField {
field: String,
type_name: String,
span: Span,
},
AssignmentToImmutable {
span: Span,
},
PositionalArgInStruct {
struct_name: String,
position: usize,
span: Span,
},
EnumVariantWithoutData {
variant: String,
enum_name: String,
span: Span,
},
EnumVariantRequiresData {
variant: String,
enum_name: String,
span: Span,
},
MutabilityMismatch {
param: String,
span: Span,
},
UseAfterSink {
name: String,
span: Span,
},
GenericArityMismatch {
name: String,
expected: usize,
actual: usize,
span: Span,
},
GenericConstraintViolation {
arg: String,
constraint: String,
span: Span,
},
OutOfScopeTypeParameter {
param: String,
span: Span,
},
MissingGenericArguments {
name: String,
span: Span,
},
DuplicateGenericParam {
param: String,
span: Span,
},
ExternFnWithBody {
function: String,
span: Span,
},
RegularFnWithoutBody {
function: String,
span: Span,
},
ExternImplWithBody {
name: String,
span: Span,
},
RequiredParamAfterDefault {
function: String,
param: String,
span: Span,
},
NilAssignedToNonOptional {
expected: String,
span: Span,
},
OptionalUsedAsNonOptional {
actual: String,
expected: String,
span: Span,
},
MissingTraitMethod {
method: String,
trait_name: String,
span: Span,
},
TraitMethodSignatureMismatch {
method: String,
trait_name: String,
expected: String,
actual: String,
span: Span,
},
AmbiguousCall {
function: String,
span: Span,
},
NoMatchingOverload {
function: String,
span: Span,
},
CannotInferEnumType {
variant: String,
span: Span,
},
FunctionReturnTypeMismatch {
function: String,
expected: String,
actual: String,
span: Span,
},
ExpressionDepthExceeded {
span: Span,
},
TooManyDefinitions {
kind: &'static str,
span: Span,
},
VisibilityViolation {
name: String,
span: Span,
},
ClosureCaptureEscapesLocalBinding {
binding: String,
span: Span,
},
InternalError {
detail: String,
span: Span,
},
NumericOverflow {
written: String,
target: PrimitiveType,
span: Span,
},
PublicClosureField {
owner: String,
field: String,
span: Span,
},
}Expand description
Compiler error types
Variants§
InvalidCharacter
UnterminatedString
UnterminatedBlockComment
InvalidUnicodeEscape
InvalidNumber
UnexpectedToken
UnexpectedEof
UndefinedReference
TypeMismatch
DuplicateDefinition
ModuleNotFound
ModuleReadError
CircularImport
PrivateImport
ImportItemNotFound
ParseError
UndefinedType
PrimitiveRedefinition
TraitUsedAsValueType
A trait name appeared in a type position that produces a value
(parameter, return, let annotation, struct/enum field, closure
param/return). FormaLang has no dynamic dispatch — trait values
must be passed via a generic-bounded parameter
(fn foo<T: SomeTrait>(x: T)) so the concrete type is known
after monomorphisation.
UndefinedTrait
NotATrait
MissingTraitField
TraitFieldTypeMismatch
CircularDependency
InvalidBinaryOp
ForLoopNotArray
ArrayDestructuringNotArray
StructDestructuringNotStruct
InvalidIfCondition
MatchNotEnum
NonExhaustiveMatch
DuplicateMatchArm
UnknownEnumVariant
VariantArityMismatch
MissingField
UnknownField
AssignmentToImmutable
PositionalArgInStruct
EnumVariantWithoutData
EnumVariantRequiresData
MutabilityMismatch
UseAfterSink
GenericArityMismatch
GenericConstraintViolation
OutOfScopeTypeParameter
MissingGenericArguments
DuplicateGenericParam
ExternFnWithBody
An extern fn declaration includes a body, which is not allowed.
RegularFnWithoutBody
A non-extern function is missing its body expression.
ExternImplWithBody
An extern impl block contains at least one function with a body.
RequiredParamAfterDefault
A parameter without a default value appears after one with a
default value. Default values must be positional from the
right (no required parameter may follow a defaulted one,
excluding self).
NilAssignedToNonOptional
nil literal assigned to a non-optional type.
OptionalUsedAsNonOptional
Optional type used where a non-optional is required.
MissingTraitMethod
A trait implementation is missing a method required by the trait.
TraitMethodSignatureMismatch
A method’s signature in an impl block does not match the trait’s declaration.
AmbiguousCall
More than one overload of a function matches the call arguments.
NoMatchingOverload
No overload of a function matches the call arguments.
CannotInferEnumType
FunctionReturnTypeMismatch
ExpressionDepthExceeded
Expression nesting exceeded the compiler recursion limit.
TooManyDefinitions
Module contains more definitions than the ID space allows (> u32::MAX).
VisibilityViolation
Attempted to access a private item from outside its defining module.
ClosureCaptureEscapesLocalBinding
A closure returned from a function captures a binding that does not
outlive the function. Only sink parameters and outer-scope bindings
may be captured by an escaping closure.
InternalError
A compiler invariant was violated during lowering or analysis. This is
always a bug in the compiler itself — the detail field documents
which invariant failed so it can be reported and fixed.
NumericOverflow
An integer literal does not fit in its declared (or default) target
primitive — e.g. 2147483648I32 exceeds i32::MAX, or an unsuffixed
9_999_999_999 exceeds the I32 default.
PublicClosureField
A pub struct or pub enum variant declares a field whose type is
a closure. Closures are an internal abstraction; they cannot be part
of a publicly exposed type because they have no stable representation
across the module / backend boundary.
Implementations§
Trait Implementations§
Source§impl Clone for CompilerError
impl Clone for CompilerError
Source§fn clone(&self) -> CompilerError
fn clone(&self) -> CompilerError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CompilerError
impl Debug for CompilerError
Source§impl Display for CompilerError
impl Display for CompilerError
Source§impl Error for CompilerError
impl Error for CompilerError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl PartialEq for CompilerError
impl PartialEq for CompilerError
impl Eq for CompilerError
impl StructuralPartialEq for CompilerError
Auto Trait Implementations§
impl Freeze for CompilerError
impl RefUnwindSafe for CompilerError
impl Send for CompilerError
impl Sync for CompilerError
impl Unpin for CompilerError
impl UnsafeUnpin for CompilerError
impl UnwindSafe for CompilerError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);