DiagnosticEntry

Trait DiagnosticEntry 

Source
pub trait DiagnosticEntry<'db>:
    Clone
    + Debug
    + Eq
    + Hash {
    // Required methods
    fn format(&self, db: &'db dyn Database) -> String;
    fn location(&self, db: &'db dyn Database) -> SpanInFile<'db>;
    fn is_same_kind(&self, other: &Self) -> bool;

    // Provided methods
    fn notes(&self, _db: &'db dyn Database) -> &[DiagnosticNote<'_>] { ... }
    fn severity(&self) -> Severity { ... }
    fn error_code(&self) -> Option<ErrorCode> { ... }
}
Expand description

A trait for diagnostics (i.e., errors and warnings) across the compiler. Meant to be implemented by each module that may produce diagnostics.

Required Methods§

Source

fn format(&self, db: &'db dyn Database) -> String

Source

fn location(&self, db: &'db dyn Database) -> SpanInFile<'db>

Source

fn is_same_kind(&self, other: &Self) -> bool

Returns true if the two should be regarded as the same kind when filtering duplicate diagnostics.

Provided Methods§

Source

fn notes(&self, _db: &'db dyn Database) -> &[DiagnosticNote<'_>]

Source

fn severity(&self) -> Severity

Source

fn error_code(&self) -> Option<ErrorCode>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§