mirror of https://github.com/zkat/miette.git
fix(context): get labels/snippets working when using .context()
This commit is contained in:
parent
db637a366b
commit
41cb710a7d
|
|
@ -144,6 +144,14 @@ where
|
|||
fn labels<'a>(&'a self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + 'a>> {
|
||||
self.error.labels()
|
||||
}
|
||||
|
||||
fn source_code(&self) -> Option<&dyn crate::SourceCode> {
|
||||
self.error.source_code()
|
||||
}
|
||||
|
||||
fn related<'a>(&'a self) -> Option<Box<dyn Iterator<Item = &'a dyn Diagnostic> + 'a>> {
|
||||
self.error.related()
|
||||
}
|
||||
}
|
||||
|
||||
impl<D> Diagnostic for ContextError<D, Report>
|
||||
|
|
@ -169,6 +177,14 @@ where
|
|||
fn labels<'a>(&'a self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + 'a>> {
|
||||
self.error.inner.diagnostic().labels()
|
||||
}
|
||||
|
||||
fn source_code(&self) -> Option<&dyn crate::SourceCode> {
|
||||
self.error.source_code()
|
||||
}
|
||||
|
||||
fn related<'a>(&'a self) -> Option<Box<dyn Iterator<Item = &'a dyn Diagnostic> + 'a>> {
|
||||
self.error.related()
|
||||
}
|
||||
}
|
||||
|
||||
struct Quoted<D>(D);
|
||||
|
|
|
|||
|
|
@ -94,6 +94,14 @@ impl Diagnostic for BoxedError {
|
|||
fn labels<'a>(&'a self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + 'a>> {
|
||||
self.0.labels()
|
||||
}
|
||||
|
||||
fn source_code(&self) -> Option<&dyn miette::SourceCode> {
|
||||
self.0.source_code()
|
||||
}
|
||||
|
||||
fn related<'a>(&'a self) -> Option<Box<dyn Iterator<Item = &'a dyn Diagnostic> + 'a>> {
|
||||
self.0.related()
|
||||
}
|
||||
}
|
||||
|
||||
impl Debug for BoxedError {
|
||||
|
|
|
|||
Loading…
Reference in New Issue