Expand description
Diagnostic emission plumbing.
Compiler phases push diagnostics into a DiagnosticSink rather than
returning a Vec. This crate ships exactly one sink, CollectingSink,
which gathers everything and tracks whether any error-severity
diagnostic was seen. Rendering sinks (and any future
suppression/severity-resolver wrappers) live in the consumer; the CLI
binary owns presentation, mos-core owns data.
§Err means structural abort, not error diagnostic
DiagnosticResult::Err signals that a phase cannot structurally
continue producing meaningful output (a fatal IO failure, a violated
internal invariant). It is not returned merely because an
Error-severity diagnostic was emitted. Ordinary error diagnostics are
collected and remembered via CollectingSink::had_error; the caller
(the CLI) enforces phase barriers by checking that between phases and
exiting before the next one starts. Conflating the two would unwind the
parser on the first error and hide every later one.
Structs§
- Collecting
Sink - Collects every diagnostic and remembers whether any was an error.
- Diagnostic
Abort - A phase aborted for structural reasons (see the module docs). Carries no payload: the diagnostics explaining why have already been emitted to the sink.
Traits§
- Diagnostic
Sink - Receiver for diagnostics emitted during a compiler phase.
Type Aliases§
- Diagnostic
Result - Result of a compiler phase.
Ok(T)on (possibly diagnostic-bearing) completion;Err(DiagnosticAbort)only on a structural abort.