#[repr(C)]
pub enum DiagnosticMessage {
Show 90 variants FractionAfterNumeric {}, NoDigitsAfterDot {}, UnknownTypeOfPercentString {}, NumericLiteralWithoutDigits {}, UnterminatedList {}, UnterminatedRegexp {}, UnterminatedString {}, UnterminatedQuotedString {}, InvalidUnicodeEscape {}, TooLargeUnicodeCodepoint {}, InvalidUnicodeCodepoint {}, MultipleCodepointAtSingleChar {}, InvalidEscapeCharacter {}, InvalidHexEscape {}, UnterminatedHeredoc { heredoc_id: String, }, UnterminatedHeredocId {}, SlashRAtMiddleOfLine {}, DStarInterpretedAsArgPrefix {}, StarInterpretedAsArgPrefix {}, AmpersandInterpretedAsArgPrefix {}, TripleDotAtEol {}, ParenthesesIterpretedAsArglist {}, AmbiguousFirstArgument { operator: u8, }, AmbiguousOperator { operator: String, interpreted_as: String, }, InvalidCharacterSyntax { suggestion: String, }, InvalidOctalDigit {}, TrailingCharInNumber { c: u8, }, EmbeddedDocumentMeetsEof {}, InvalidChar { c: u8, }, IncompleteCharacterSyntax {}, GvarWithoutId {}, InvalidGvarName { c: u8, }, IvarWithoutId {}, InvalidIvarName { c: u8, }, CvarWithoutId {}, InvalidCvarName { c: u8, }, UnknownRegexOptions { options: String, }, UnterminatedUnicodeEscape {}, EncodingError { error: String, }, InvalidMultibyteChar {}, AmbiguousTernaryOperator { condition: String, }, AmbiguousRegexp {}, ElseWithoutRescue {}, BeginNotAtTopLevel {}, AliasNthRef {}, CsendInsideMasgn {}, ClassOrModuleNameMustBeConstant {}, EndlessSetterDefinition {}, UnexpectedToken { token_name: String, }, ClassDefinitionInMethodBody {}, ModuleDefinitionInMethodBody {}, InvalidReturnInClassOrModuleBody {}, ConstArgument {}, IvarArgument {}, GvarArgument {}, CvarArgument {}, NoSuchLocalVariable { var_name: String, }, OrdinaryParamDefined {}, NumparamUsed {}, TokAtEolWithoutExpression { token_name: String, }, InvalidIdToGet { identifier: String, }, ForwardArgAfterRestarg {}, NoAnonymousBlockarg {}, EndInMethod {}, ComparisonAfterComparison { comparison: String, }, DuplicateHashKey {}, CircularArgumentReference { arg_name: String, }, DynamicConstantAssignment {}, CantAssignToSelf {}, CantAssignToNil {}, CantAssignToTrue {}, CantAssignToFalse {}, CantAssignToFile {}, CantAssignToLine {}, CantAssignToEncoding {}, CantAssignToNumparam { numparam: String, }, CantSetVariable { var_name: String, }, BlockGivenToYield {}, BlockAndBlockArgGiven {}, SymbolLiteralWithInterpolation {}, ReservedForNumparam { numparam: String, }, KeyMustBeValidAsLocalVariable {}, DuplicateVariableName {}, DuplicateKeyName {}, SingletonLiteral {}, NthRefIsTooBig { nth_ref: String, }, DuplicatedArgumentName {}, RegexError { error: String, }, InvalidSymbol { symbol: String, }, VoidValueExpression {},
}
Expand description

Enum of all possible diagnostic message (both warnings and errors)

Variants§

§

FractionAfterNumeric

Fields

Emitted for code

1.2.3
§

NoDigitsAfterDot

Fields

Emitted for code like

foo.2
§

UnknownTypeOfPercentString

Fields

Emitted for code like

%k[foo]
§

NumericLiteralWithoutDigits

Fields

Emitted for code like

0b
§

UnterminatedList

Fields

Emitted for code like

%w[foo bar
§

UnterminatedRegexp

Fields

Emitted for code like

/foo
§

UnterminatedString

Fields

Emitted for code like

"foo
§

UnterminatedQuotedString

Fields

Emitted for code like

%s
//    ^ EOF, not "

§

InvalidUnicodeEscape

Fields

Emitted for code like

"\ufoo"
§

TooLargeUnicodeCodepoint

Fields

Emitted for code like

"\u{999999}"
§

InvalidUnicodeCodepoint

Fields

Emitted for code like

"\u{d800}"
§

MultipleCodepointAtSingleChar

Fields

Emitted for code like

?\u{41 42}
§

InvalidEscapeCharacter

Fields

Emitted for code like

"\M-"
§

InvalidHexEscape

Fields

Emitted for code like

"\xZZ"
§

UnterminatedHeredoc

Fields

§heredoc_id: String

Heredoc identifier

Emitted for code like

<<-HERE
§

UnterminatedHeredocId

Fields

Emitted for code like

<<-"HERE
§

SlashRAtMiddleOfLine

Fields

Emitted for code like

eval("foo \r = 42")
§

DStarInterpretedAsArgPrefix

Fields

Emitted for code like (only in $VERBOSE mode)

foo **arg
§

StarInterpretedAsArgPrefix

Fields

Emitted for code like (only in $VERBOSE mode)

foo *arg
§

AmpersandInterpretedAsArgPrefix

Fields

Emitted for code like (only in $VERBOSE mode)

foo &arg
§

TripleDotAtEol

Fields

Emitted for code like

range = 1...
§

ParenthesesIterpretedAsArglist

Fields

Emitted for code like (only in $VERBOSE mode)

def m (a, b, c); end
§

AmbiguousFirstArgument

Fields

§operator: u8

Operator that is ambiguous

Emitted for code like (only in $VERBOSE mode)

m +foo
§

AmbiguousOperator

Fields

§operator: String

Operator that is ambiguous

§interpreted_as: String

Interpretation of this operator

Emitted for code like (only in $VERBOSE mode)

1 *2
§

InvalidCharacterSyntax

Fields

§suggestion: String

Valid syntax sugestions

Emitted for code like

"\M- "
§

InvalidOctalDigit

Fields

Emitted for code like

09
§

TrailingCharInNumber

Fields

§c: u8

Invalid trailing char

Emitted for code like

0_a
§

EmbeddedDocumentMeetsEof

Fields

Emitted for code like

=begin
§

InvalidChar

Fields

§c: u8

char

Emitted for code like

eval("\x01foo")
§

IncompleteCharacterSyntax

Fields

It is unknown how to trigger this error. Code that triggers it in MRI can be dead.

§

GvarWithoutId

Fields

Emitted for code like

$
§

InvalidGvarName

Fields

§c: u8

char after $

Emitted for code like

$@
§

IvarWithoutId

Fields

Emitted for code like

@
§

InvalidIvarName

Fields

§c: u8

char after @

Emitted for code like

@1
§

CvarWithoutId

Fields

Emitted for code like

@@
§

InvalidCvarName

Fields

§c: u8

char after @@

Emitted for code like

@@1
§

UnknownRegexOptions

Fields

§options: String

Concatenated unknown options

Emitted for code like

/re/foo
§

UnterminatedUnicodeEscape

Fields

Emitted for code like

"\u{1234"
§

EncodingError

Fields

§error: String

Error from decoder

Emitted for code like

# encoding: foo
§

InvalidMultibyteChar

Fields

Emitter for code like

eval("\xFF = 42")
§

AmbiguousTernaryOperator

Fields

§condition: String

Source of the condition expression

Emitted for code like

a ?AA : 2
§

AmbiguousRegexp

Fields

Emitted for code like

m /foo/
§

ElseWithoutRescue

Fields

Emitted for code like

begin; else; end
§

BeginNotAtTopLevel

Fields

Emitted for code like

def f; BEGIN{}; end
§

AliasNthRef

Fields

Emitted for code like

alias $a $1
§

CsendInsideMasgn

Fields

Emitted for code like

*a&.x = 0
§

ClassOrModuleNameMustBeConstant

Fields

Emitted for code like

module foo; end
§

EndlessSetterDefinition

Fields

Emitted for code like

def foo=() = 42
§

UnexpectedToken

Fields

§token_name: String

Name of the token

Emitted for any code that produces invalid sequence of tokens

§

ClassDefinitionInMethodBody

Fields

Emitted for code like

def a; class Foo; end; end
§

ModuleDefinitionInMethodBody

Fields

Emitted for code like

def a; module Foo; end; end
§

InvalidReturnInClassOrModuleBody

Fields

Emitted for code like

class A; return; end
§

ConstArgument

Fields

Emitted for code like

def foo(Abc); end
§

IvarArgument

Fields

Emitted for code like

def foo(@abc); end
§

GvarArgument

Fields

Emitted for code like

def foo($abc); end
§

CvarArgument

Fields

Emitted for code like

def foo(@@abc); end
§

NoSuchLocalVariable

Fields

§var_name: String

Variable name

Emitted for code like

case 0; in ^a; true; end
§

OrdinaryParamDefined

Fields

Emitted for code like

m { |a| _1 }
§

NumparamUsed

Fields

Emitted for code like

foo { _1; bar { _2 }; }
§

TokAtEolWithoutExpression

Fields

§token_name: String

Name of the token

Emitted for code like (only in $VERBOSE mode)

if
42
end
§

InvalidIdToGet

Fields

§identifier: String

Identifier

Emitted for code like

{ foo?: }
# or
{ foo!: }
§

ForwardArgAfterRestarg

Fields

Emitted for code like

def foo *rest, ...
end
§

NoAnonymousBlockarg

Fields

Emitted for code like

def foo(); bar(&); end
§

EndInMethod

Fields

Emitted for code like

def m; END {}; end
§

ComparisonAfterComparison

Fields

§comparison: String

Source of the first comparison

Emitted for code like (only in $VERBOSE mode)

a < b < c
§

DuplicateHashKey

Fields

Emitted for code like

{ 42 => value, 42 => another_value }
§

CircularArgumentReference

Fields

§arg_name: String

Name of the argument

Emitted for code like

def m(foo = foo) end
§

DynamicConstantAssignment

Fields

Emitted for code like

def m; FOO = 1; end
§

CantAssignToSelf

Fields

Emitted for code like

self = foo
§

CantAssignToNil

Fields

Emitted for code like

nil = foo
§

CantAssignToTrue

Fields

Emitted for code like

true = foo
§

CantAssignToFalse

Fields

Emitted for code like

false = foo
§

CantAssignToFile

Fields

Emitted for code like

__FILE__ = foo
§

CantAssignToLine

Fields

Emitted for code like

__LINE__ = foo
§

CantAssignToEncoding

Fields

Emitted for code like

__ENCODING__ = foo
§

CantAssignToNumparam

Fields

§numparam: String

Source of the numbered parameter

Emitted for code like

proc {_1; _1 = nil}
§

CantSetVariable

Fields

§var_name: String

Source of the read-only variable that is assigned

Emitted for code like

$1 = foo
§

BlockGivenToYield

Fields

Emitted for code like

yield(&foo)
§

BlockAndBlockArgGiven

Fields

Emitted for code like

fun(&bar) do end
§

SymbolLiteralWithInterpolation

Fields

Emitted for code like

case a; in "#{a}": 1; end
§

ReservedForNumparam

Fields

§numparam: String

Numbered parameter that is treated as a local variable

Emitted for code like

_1 = 1
§

KeyMustBeValidAsLocalVariable

Fields

Emitted for code like

case a; in a?:; end
§

DuplicateVariableName

Fields

Emitted for code like

case 0; in a, a; end
§

DuplicateKeyName

Fields

Emitted for code like

case 0; in a: 1, a: 2; end
§

SingletonLiteral

Fields

Emitted for code like

def (1).foo; end
§

NthRefIsTooBig

Fields

§nth_ref: String

Source of the nth_ref that is techincally a regular global variable

Emitted for code like (only in $VERBOSE mode)

$100
§

DuplicatedArgumentName

Fields

Emitted for code like

def foo(aa, aa); end
§

RegexError

Fields

§error: String

Error from Onigurama engine

Emitted for code like

/[/
§

InvalidSymbol

Fields

§symbol: String

Source of the symbol

Emitted for code like

%I"x .\xc3."
§

VoidValueExpression

Fields

Emitted for code like

a = return

Implementations§

source§

impl DiagnosticMessage

source

pub fn render(&self) -> String

Renders DiagnosticMessage by interpolating all dynamic values into a template

Trait Implementations§

source§

impl Clone for DiagnosticMessage

source§

fn clone(&self) -> DiagnosticMessage

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 DiagnosticMessage

source§

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

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

impl PartialEq<DiagnosticMessage> for DiagnosticMessage

source§

fn eq(&self, other: &DiagnosticMessage) -> 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 Eq for DiagnosticMessage

source§

impl StructuralEq for DiagnosticMessage

source§

impl StructuralPartialEq for DiagnosticMessage

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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> ToOwned for Twhere 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, U> TryFrom<U> for Twhere 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 Twhere 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.