Skip to main content

Diagnostic

Struct Diagnostic 

Source
pub struct Diagnostic {
    pub inner: Box<DiagnosticsInner>,
}
Expand description

The Diagnostics struct describes an issue encountered during compile time. The issue is defined by an error_code and had a defined severity Diagnostic severity can be overridden when being reported.

Fields§

§inner: Box<DiagnosticsInner>

Implementations§

Source§

impl Diagnostic

Builder for Diagnostics

Source

pub fn new(message: impl Into<String>) -> Self

Source

pub fn with_location<T>(self, location: T) -> Self
where T: Into<SourceLocation>,

Source

pub fn with_secondary_location<T>(self, location: T) -> Self
where T: Into<SourceLocation>,

Source

pub fn with_secondary_locations(self, locations: Vec<SourceLocation>) -> Self

Source

pub fn with_error_code(self, code: &'static str) -> Self

Source

pub fn with_sub_diagnostic(self, diagnostic: Diagnostic) -> Self

Source

pub fn with_sub_diagnostics(self, diagnostics: Vec<Diagnostic>) -> Self

Source

pub fn with_internal_error(self, error: Error) -> Self

Source

pub fn from_serde_error(error: Error, source: &SourceCode) -> Self

Source§

impl Diagnostic

Source

pub fn get_message(&self) -> &str

Source

pub fn get_location(&self) -> SourceLocation

Source

pub fn get_secondary_locations(&self) -> Option<&[SourceLocation]>

Source

pub fn get_error_code(&self) -> &'static str

Source

pub fn get_sub_diagnostics(&self) -> Vec<&Diagnostic>

Source§

impl Diagnostic

Source

pub fn unexpected_token_found<T>( expected: &str, found: &str, location: T, ) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn missing_function<T>(location: T) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn codegen_error<T, U>(message: T, location: U) -> Diagnostic
where T: Into<String>, U: Into<SourceLocation>,

Source

pub fn llvm_error(file: &str, llvm_error: &str) -> Diagnostic

Source

pub fn missing_token<T>(expected_token: &str, location: T) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn invalid_argument_count<T>( expected: usize, actual: usize, location: T, ) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn unknown_type<T>(type_name: &str, location: T) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn unresolved_reference<T>(reference: &str, location: T) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn invalid_assignment<T>( right_type: &str, left_type: &str, location: T, ) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn invalid_polymorphic_assignment<T>( right_type: &str, left_type: &str, location: T, ) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn invalid_interface_pou_assignment<T>( pou_name: &str, interface_name: &str, location: T, ) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn invalid_interface_assignment<T>( source_iface: &str, target_iface: &str, location: T, ) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn invalid_direct_interface_call<T>(location: T) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn cannot_generate_initializer<T>( variable_name: &str, location: T, ) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn cannot_generate_call_statement(operator: &AstNode) -> Diagnostic

Source

pub fn cannot_generate_from_empty_literal<T>( type_name: &str, location: T, ) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn const_pragma_is_not_allowed<T>(location: T) -> Diagnostic
where T: Into<SourceLocation>,

Source§

impl Diagnostic

Source

pub fn unnamed_control<T>(location: T) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn unsupported_cfc_expression<T>( expression: &str, location: T, ) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn unconnected_element<T>(name: &str, location: T) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn disconnected_return<T>(location: T) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn duplicate_connector<T>(label: &str, location: T) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn dangling_continuation<T>(label: &str, location: T) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn open_connector<T>(label: &str, location: T) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn undefined_jump_target<T>(label: &str, location: T) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn unused_label<T>(label: &str, location: T) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn duplicate_label<T>(label: &str, location: T) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn unknown_block_type<T>(name: &str, location: T) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn undeclared_block_output<T>( output: &str, name: &str, location: T, ) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn unconnected_en<T>(name: &str, location: T) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn eno_cycle<T>(name: &str, location: T) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn negated_reference_assignment<T>(name: &str, location: T) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn duplicate_return_pin<T>(name: &str, location: T) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn disconnected_jump<T>(location: T) -> Diagnostic
where T: Into<SourceLocation>,

Source

pub fn unresolved_generic_output<T>(block: &str, location: T) -> Diagnostic
where T: Into<SourceLocation>,

Trait Implementations§

Source§

impl Debug for Diagnostic

Source§

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

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

impl Deref for Diagnostic

Source§

type Target = DiagnosticsInner

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for Diagnostic

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl Display for Diagnostic

Source§

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

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

impl Error for Diagnostic

Source§

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

Returns 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<Error> for Diagnostic

Source§

fn from(value: Error) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Diagnostic

Source§

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

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> 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.