Skip to main content

Diagnostics

Struct Diagnostics 

Source
pub struct Diagnostics { /* private fields */ }
Expand description

Accumulator for compile-pipeline diagnostics.

Each stage in merge → expand → analyze → lower → validate runs per-rule / per-node “leaf checks” against the input. Historically every leaf check used ? to early-return, which meant an operator running vane compile <dir> only ever saw the first error: fix that, re-run, see the next, fix that, re-run, etc. With Diagnostics, leaf checks push instead of ?-returning and the stage boundary decides whether to bail with the full accumulator or continue into the next stage.

Every entry currently has the same severity (compile error). The has_fatal helper exists so callers can express the “any error stops the next stage” gate clearly at stage boundaries; future warning-level diagnostics would slot in without changing call sites.

Implementations§

Source§

impl Diagnostics

Source

pub const fn new() -> Self

Source

pub fn push(&mut self, e: Error)

Source

pub fn extend<I: IntoIterator<Item = Error>>(&mut self, iter: I)

Source

pub fn is_empty(&self) -> bool

Source

pub fn len(&self) -> usize

Source

pub fn has_fatal(&self) -> bool

True when the accumulator carries at least one error that should stop the pipeline at the next stage boundary. Equivalent to !is_empty() today; reserved as a hook for warning-level diagnostics that might land here in the future.

Source

pub fn entries(&self) -> &[Error]

Source

pub fn into_errors(self) -> Vec<Error>

Source

pub fn into_result<T>(self, value: T) -> Result<T, Self>

Stage-boundary gate. Returns Ok(value) when no diagnostics have been pushed; otherwise returns Err(Self) so the caller can either bubble or merge it into another accumulator.

§Errors

Returns self when has_fatal() is true.

Trait Implementations§

Source§

impl Debug for Diagnostics

Source§

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

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

impl Default for Diagnostics

Source§

fn default() -> Diagnostics

Returns the “default value” for a type. Read more
Source§

impl Display for Diagnostics

Source§

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

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

impl From<Diagnostics> for Error

Collapse the accumulated diagnostics into a single ErrorKind::Compile Error whose context carries every entry’s to_string(), separated by \n. Used at the boundary into APIs whose error channel is a single Error (e.g. the existing compile() facade, the management-RPC wire payload).

Source§

fn from(d: Diagnostics) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Diagnostics

Source§

fn from(e: Error) -> Self

Converts to this type from the input type.

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more