-
-
Notifications
You must be signed in to change notification settings - Fork 203
Description
Problem statement
Built-in derive macros (e.g., Debug) behave differently than thiserror::Error wrt propagation of #[allow(...)] attributes.
Built-in macros
allow attributes are propagated to auto-generated impls.
thiserror::Error
allow attributes are not propagated to auto-generated impls.
Example
#[deprecated]
#[allow(deprecated, never_type_fallback_flowing_into_unsafe)]
#[derive(Debug, Error)]
#[error("B")]
pub struct B;gets expanded into (formatted for readability):
#[deprecated]
#[allow(deprecated, never_type_fallback_flowing_into_unsafe)]
#[error("B")]
pub struct B;
#[automatically_derived]
#[allow(deprecated, never_type_fallback_flowing_into_unsafe)]
impl ::core::fmt::Debug for B {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f, "B")
}
}
#[allow(unused_qualifications)]
#[automatically_derived]
impl ::thiserror::__private::Error for B {}
#[allow(unused_qualifications)]
#[automatically_derived]
impl ::core::fmt::Display for B {
#[allow(clippy::used_underscore_binding)]
fn fmt(&self, __formatter: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
#[allow(unused_variables, deprecated)]
let Self {} = self;
__formatter.write_str("B")
}
}Proposed solution
Do propagate allows to impls generated by thiserror::Error.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels