Given a structure deriving Diagnostic with an unexpected field attribute #[diagnostic(bogus)], I expect that miette would report an error but it does not. The following struct compiles without error, simply ignoring the attribute.
use miette::Diagnostic;
use thiserror::Error;
#[derive(Diagnostic, Error, Debug)]
#[error("")]
struct E {
#[diagnostic(bogus)]
i: i32
}
This is particularly problematic when the attribute is in fact supported on records. For example, if a field is annotated with #[diagnostic(transparent)], it feels reasonable to think it will forward the diagnostic impl to that field, but instead the annotation is silently ignored.
#[derive(Diagnostic, Error, Debug)]
#[error("")]
struct E2 {
#[diagnostic(transparent)]
e: E
}
This specifically lead to a bug in our library where some errors where missing source labels and help messages.
Given a structure deriving
Diagnosticwith an unexpected field attribute#[diagnostic(bogus)], I expect that miette would report an error but it does not. The following struct compiles without error, simply ignoring the attribute.This is particularly problematic when the attribute is in fact supported on records. For example, if a field is annotated with
#[diagnostic(transparent)], it feels reasonable to think it will forward the diagnostic impl to that field, but instead the annotation is silently ignored.This specifically lead to a bug in our library where some errors where missing source labels and help messages.