pub trait Diagnostic: Any + Send + Sync + Debug + 'static {
    fn message(&self) -> String;
    fn source(&self) -> InFile<SyntaxNodePtr>;
    fn as_any(&self) -> &(dyn Any + Send + 'static);

    fn highlight_range(&self) -> TextRange { ... }
}
Expand description

Diagnostic defines mun_hir API for errors and warnings.

It is used as a dyn object, which you can downcast to concrete diagnostics. DiagnosticSink are structured, meaning that they include rich information which can be used by IDE to create fixes.

Internally, various subsystems of HIR produce diagnostics specific to a subsystem (typically, an enum), which are safe to store in salsa but do not include source locations. Such internal diagnostics are transformed into an instance of Diagnostic on demand.

Required Methods§

Provided Methods§

Implementations§

Implementors§