Skip to main content

DiagnosticMessage

Enum DiagnosticMessage 

Source
#[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

Emitted for code

1.2.3
§

NoDigitsAfterDot

Emitted for code like

foo.2
§

UnknownTypeOfPercentString

Emitted for code like

%k[foo]
§

NumericLiteralWithoutDigits

Emitted for code like

0b
§

UnterminatedList

Emitted for code like

%w[foo bar
§

UnterminatedRegexp

Emitted for code like

/foo
§

UnterminatedString

Emitted for code like

"foo
§

UnterminatedQuotedString

Emitted for code like

%s
//    ^ EOF, not "
§

InvalidUnicodeEscape

Emitted for code like

"\ufoo"
§

TooLargeUnicodeCodepoint

Emitted for code like

"\u{999999}"
§

InvalidUnicodeCodepoint

Emitted for code like

"\u{d800}"
§

MultipleCodepointAtSingleChar

Emitted for code like

?\u{41 42}
§

InvalidEscapeCharacter

Emitted for code like

"\M-"
§

InvalidHexEscape

Emitted for code like

"\xZZ"
§

UnterminatedHeredoc

Emitted for code like

<<-HERE

Fields

§heredoc_id: String

Heredoc identifier

§

UnterminatedHeredocId

Emitted for code like

<<-"HERE
§

SlashRAtMiddleOfLine

Emitted for code like

eval("foo \r = 42")
§

DStarInterpretedAsArgPrefix

Emitted for code like (only in $VERBOSE mode)

foo **arg
§

StarInterpretedAsArgPrefix

Emitted for code like (only in $VERBOSE mode)

foo *arg
§

AmpersandInterpretedAsArgPrefix

Emitted for code like (only in $VERBOSE mode)

foo &arg
§

TripleDotAtEol

Emitted for code like

range = 1...
§

ParenthesesIterpretedAsArglist

Emitted for code like (only in $VERBOSE mode)

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

AmbiguousFirstArgument

Emitted for code like (only in $VERBOSE mode)

m +foo

Fields

§operator: u8

Operator that is ambiguous

§

AmbiguousOperator

Emitted for code like (only in $VERBOSE mode)

1 *2

Fields

§operator: String

Operator that is ambiguous

§interpreted_as: String

Interpretation of this operator

§

InvalidCharacterSyntax

Emitted for code like

"\M- "

Fields

§suggestion: String

Valid syntax sugestions

§

InvalidOctalDigit

Emitted for code like

09
§

TrailingCharInNumber

Emitted for code like

0_a

Fields

§c: u8

Invalid trailing char

§

EmbeddedDocumentMeetsEof

Emitted for code like

=begin
§

InvalidChar

Emitted for code like

eval("\x01foo")

Fields

§c: u8

char

§

IncompleteCharacterSyntax

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

§

GvarWithoutId

Emitted for code like

$
§

InvalidGvarName

Emitted for code like

$@

Fields

§c: u8

char after $

§

IvarWithoutId

Emitted for code like

@
§

InvalidIvarName

Emitted for code like

@1

Fields

§c: u8

char after @

§

CvarWithoutId

Emitted for code like

@@
§

InvalidCvarName

Emitted for code like

@@1

Fields

§c: u8

char after @@

§

UnknownRegexOptions

Emitted for code like

/re/foo

Fields

§options: String

Concatenated unknown options

§

UnterminatedUnicodeEscape

Emitted for code like

"\u{1234"
§

EncodingError

Emitted for code like

# encoding: foo

Fields

§error: String

Error from decoder

§

InvalidMultibyteChar

Emitter for code like

eval("\xFF = 42")
§

AmbiguousTernaryOperator

Emitted for code like

a ?AA : 2

Fields

§condition: String

Source of the condition expression

§

AmbiguousRegexp

Emitted for code like

m /foo/
§

ElseWithoutRescue

Emitted for code like

begin; else; end
§

BeginNotAtTopLevel

Emitted for code like

def f; BEGIN{}; end
§

AliasNthRef

Emitted for code like

alias $a $1
§

CsendInsideMasgn

Emitted for code like

*a&.x = 0
§

ClassOrModuleNameMustBeConstant

Emitted for code like

module foo; end
§

EndlessSetterDefinition

Emitted for code like

def foo=() = 42
§

UnexpectedToken

Emitted for any code that produces invalid sequence of tokens

Fields

§token_name: String

Name of the token

§

ClassDefinitionInMethodBody

Emitted for code like

def a; class Foo; end; end
§

ModuleDefinitionInMethodBody

Emitted for code like

def a; module Foo; end; end
§

InvalidReturnInClassOrModuleBody

Emitted for code like

class A; return; end
§

ConstArgument

Emitted for code like

def foo(Abc); end
§

IvarArgument

Emitted for code like

def foo(@abc); end
§

GvarArgument

Emitted for code like

def foo($abc); end
§

CvarArgument

Emitted for code like

def foo(@@abc); end
§

NoSuchLocalVariable

Emitted for code like

case 0; in ^a; true; end

Fields

§var_name: String

Variable name

§

OrdinaryParamDefined

Emitted for code like

m { |a| _1 }
§

NumparamUsed

Emitted for code like

foo { _1; bar { _2 }; }
§

TokAtEolWithoutExpression

Emitted for code like (only in $VERBOSE mode)

if
42
end

Fields

§token_name: String

Name of the token

§

InvalidIdToGet

Emitted for code like

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

Fields

§identifier: String

Identifier

§

ForwardArgAfterRestarg

Emitted for code like

def foo *rest, ...
end
§

NoAnonymousBlockarg

Emitted for code like

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

EndInMethod

Emitted for code like

def m; END {}; end
§

ComparisonAfterComparison

Emitted for code like (only in $VERBOSE mode)

a < b < c

Fields

§comparison: String

Source of the first comparison

§

DuplicateHashKey

Emitted for code like

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

CircularArgumentReference

Emitted for code like

def m(foo = foo) end

Fields

§arg_name: String

Name of the argument

§

DynamicConstantAssignment

Emitted for code like

def m; FOO = 1; end
§

CantAssignToSelf

Emitted for code like

self = foo
§

CantAssignToNil

Emitted for code like

nil = foo
§

CantAssignToTrue

Emitted for code like

true = foo
§

CantAssignToFalse

Emitted for code like

false = foo
§

CantAssignToFile

Emitted for code like

__FILE__ = foo
§

CantAssignToLine

Emitted for code like

__LINE__ = foo
§

CantAssignToEncoding

Emitted for code like

__ENCODING__ = foo
§

CantAssignToNumparam

Emitted for code like

proc {_1; _1 = nil}

Fields

§numparam: String

Source of the numbered parameter

§

CantSetVariable

Emitted for code like

$1 = foo

Fields

§var_name: String

Source of the read-only variable that is assigned

§

BlockGivenToYield

Emitted for code like

yield(&foo)
§

BlockAndBlockArgGiven

Emitted for code like

fun(&bar) do end
§

SymbolLiteralWithInterpolation

Emitted for code like

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

ReservedForNumparam

Emitted for code like

_1 = 1

Fields

§numparam: String

Numbered parameter that is treated as a local variable

§

KeyMustBeValidAsLocalVariable

Emitted for code like

case a; in a?:; end
§

DuplicateVariableName

Emitted for code like

case 0; in a, a; end
§

DuplicateKeyName

Emitted for code like

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

SingletonLiteral

Emitted for code like

def (1).foo; end
§

NthRefIsTooBig

Emitted for code like (only in $VERBOSE mode)

$100

Fields

§nth_ref: String

Source of the nth_ref that is techincally a regular global variable

§

DuplicatedArgumentName

Emitted for code like

def foo(aa, aa); end
§

RegexError

Emitted for code like

/[/

Fields

§error: String

Error from Onigurama engine

§

InvalidSymbol

Emitted for code like

%I"x .\xc3."

Fields

§symbol: String

Source of the symbol

§

VoidValueExpression

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 duplicate of the value. Read more
1.0.0 (const: unstable) · 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<(), Error>

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

impl Eq for DiagnosticMessage

Source§

impl PartialEq for DiagnosticMessage

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 StructuralPartialEq for DiagnosticMessage

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