pub trait ErrorReport: Error {
// Required methods
fn span(self) -> Span;
fn msg(&self) -> (String, String);
// Provided methods
fn report(self) -> ((String, String), Span, Option<String>)
where Self: Sized { ... }
fn source(&self) -> Option<String> { ... }
}Expand description
A trait for Errors that return a specific message and span structure.
Required Methods§
Provided Methods§
Sourcefn report(self) -> ((String, String), Span, Option<String>)where
Self: Sized,
fn report(self) -> ((String, String), Span, Option<String>)where
Self: Sized,
Return the full error report
Sourcefn source(&self) -> Option<String>
fn source(&self) -> Option<String>
Return the text source for this error message.
Usually the source of the error is just the input file, in which case we return None.
Sometimes, however, the source of the error may be a TokenStream or some other text. In this case,
the output of source should be that stream of text.