Enum IssueCode

Source
#[non_exhaustive]
#[repr(u16)]
pub enum IssueCode {
Show 23 variants Parse = 101, UnresolvedPackage = 201, NotAPackage = 202, OrphanedBreak = 203, DuplicateParam = 204, ReadUninit = 205, UnresolvedIdent = 206, IntParse = 207, FloatParse = 208, UnreachableStatement = 209, UnreachableArm = 210, DuplicateEntry = 211, LiteralAssignment = 212, TypeMismatch = 301, NilIndex = 302, IndexTypeMismatch = 303, UndefinedOperator = 304, UndefinedDisplay = 305, CallArityMismatch = 306, FnArityMismatch = 307, ResultMismatch = 308, UnknownComponent = 309, InconsistentReturns = 310,
}
Expand description

A classification of module diagnostic issues.

Each ModuleIssue object belongs to a specific class, as described by this enum type.

From an IssueCode, you can obtain additional metadata about the diagnostic issue, such as a short description (via the Display implementation of IssueCode) or the severity of the issue.

Additionally, you can convert an IssueCode into a numeric representation, which can be used to categorize diagnostics by their numeric codes in a code editor.

The numeric representation is in the XYY decimal digits format, where X represents the issue’s diagnostics depth, and YY represents the issue’s “sub-code” within that depth level.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Parse = 101

Syntax Error.

This error indicates that the source code is not well-formed from a syntactical point of view. These types of errors must be addressed first.

§

UnresolvedPackage = 201

Semantics Error.

The specified package in the use <package>; import statement is unknown to the script engine.

§

NotAPackage = 202

Semantics Error.

The component in the use foo.<component>; import statement is not a valid package.

§

OrphanedBreak = 203

Semantics Error.

The break or continue statement is used outside of a loop.

§

DuplicateParam = 204

Semantics Error.

The function already has a parameter with the same name. Function parameter names must be unique.

§

ReadUninit = 205

Semantics Error.

An attempt to use a variable that is not initialized at this point in the control flow.

§

UnresolvedIdent = 206

Semantics Error.

An attempt to use an identifier that does not correspond to any known variable within this scope or a package symbol.

§

IntParse = 207

Semantics Error.

Invalid integer literal format.

§

FloatParse = 208

Semantics Error.

Invalid floating-point literal format.

§

UnreachableStatement = 209

Semantics Warning.

This statement is not reachable during the execution of the source code. It is considered dead code. Consider removing this statement or commenting it out.

§

UnreachableArm = 210

Semantics Warning.

This match arm is not reachable during the execution of the source code. It is considered dead code. Consider removing this match arm or commenting it out.

§

DuplicateEntry = 211

Semantics Warning.

The struct declaration already contains a field with the same name.

§

LiteralAssignment = 212

Semantics Warning.

An attempt to assign to an orphaned literal. This assignment is semantically meaningless.

§

TypeMismatch = 301

Semantics Warning.

The provided type does not meet the formal requirements of the specification.

§

NilIndex = 302

Semantics Warning.

An attempt to index into a nil object.

§

IndexTypeMismatch = 303

Semantics Warning.

An attempt to index by an expression that is neither a number nor a range of integers.

§

UndefinedOperator = 304

Semantics Warning.

The object does not implement the specified operator.

§

UndefinedDisplay = 305

Semantics Warning.

The object does not implement the Display operator.

§

CallArityMismatch = 306

Semantics Warning.

The function requires either more or fewer arguments.

§

FnArityMismatch = 307

Semantics Warning.

Expected a function with a different number of parameters.

§

ResultMismatch = 308

Semantics Warning.

The function’s result type is different from the expected type.

§

UnknownComponent = 309

Semantics Warning.

The object does not have the specified field.

§

InconsistentReturns = 310

Semantics Warning.

The function has inconsistent return points. Some branches return non-nil values, while others return nil values. This issue likely indicates that a trailing return <expr>; statement is missing.

Implementations§

Source§

impl IssueCode

Source

pub fn severity(self) -> IssueSeverity

Returns the issue’s severity, which is either an error or a warning.

Source

pub fn depth(self) -> DiagnosticsDepth

Returns the level of semantic analysis depth at which this issue was inferred.

See DiagnosticsDepth for details.

Trait Implementations§

Source§

impl Clone for IssueCode

Source§

fn clone(&self) -> IssueCode

Returns a duplicate 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 IssueCode

Source§

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

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

impl Display for IssueCode

Source§

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

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

impl Hash for IssueCode

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 Ord for IssueCode

Source§

fn cmp(&self, other: &IssueCode) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for IssueCode

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for IssueCode

Source§

fn partial_cmp(&self, other: &IssueCode) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for IssueCode

Source§

impl Eq for IssueCode

Source§

impl StructuralPartialEq for IssueCode

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToCompactString for T
where T: Display,

Source§

fn to_compact_string(&self) -> CompactString

Converts the given value to a CompactString. Read more
Source§

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

Source§

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§

fn to_string(&self) -> String

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

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

Source§

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>,

Source§

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.