Skip to main content

DiagnosticSink

Trait DiagnosticSink 

Source
pub trait DiagnosticSink {
    // Required method
    fn emit(&mut self, diagnostic: Diagnostic) -> DiagnosticResult<()>;
}
Expand description

Receiver for diagnostics emitted during a compiler phase.

Implementors decide what to do with each Diagnostic (collect, render, count). Returning Err(DiagnosticAbort) asks the phase to stop for structural reasons; the in-tree sinks never do, so ? on an emit is a no-op in practice and the phase runs to completion.

Required Methods§

Source

fn emit(&mut self, diagnostic: Diagnostic) -> DiagnosticResult<()>

Accept one fully-built diagnostic.

§Errors

Returns DiagnosticAbort only if the sink wants the current phase to stop for structural reasons (not implemented by the in-tree sinks).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<S: DiagnosticSink + ?Sized> DiagnosticSink for &mut S

Forwarding impl so phases can take &mut dyn DiagnosticSink and callers can pass &mut sink of a concrete type through several layers.

Source§

fn emit(&mut self, diagnostic: Diagnostic) -> DiagnosticResult<()>

Implementors§