diff --git a/crates/ohno/examples/default_constructors.rs b/crates/ohno/examples/default_constructors.rs index 9d900eab6..010508251 100644 --- a/crates/ohno/examples/default_constructors.rs +++ b/crates/ohno/examples/default_constructors.rs @@ -6,6 +6,7 @@ use ohno::{Error, OhnoCore}; #[derive(Error)] +#[display("cannot open {path}")] struct MyError { path: String, inner: OhnoCore, diff --git a/crates/ohno/examples/derive_with_fields.rs b/crates/ohno/examples/derive_with_fields.rs index 9612c2e7f..e9c71b5ce 100644 --- a/crates/ohno/examples/derive_with_fields.rs +++ b/crates/ohno/examples/derive_with_fields.rs @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -//! Prints `InvalidQuery` +//! Prints an `InvalidQuery` through both `Display` and `Debug`. use ohno::{Error, OhnoCore}; #[derive(Error)] +#[display("invalid query: {operation} on {table}")] struct InvalidQuery { operation: String, table: String, diff --git a/crates/ohno/examples/from_attribute.rs b/crates/ohno/examples/from_attribute.rs index fd3324071..5b7a32fee 100644 --- a/crates/ohno/examples/from_attribute.rs +++ b/crates/ohno/examples/from_attribute.rs @@ -6,7 +6,9 @@ #[ohno::error] #[from(std::io::Error, std::fmt::Error)] struct MyError { + #[expect(dead_code, reason = "the example shows that #[from] fills the remaining fields")] optional_field: Option, + #[expect(dead_code, reason = "the example shows that #[from] fills the remaining fields")] count: u32, } diff --git a/crates/ohno/examples/multiple_core_fields.rs b/crates/ohno/examples/multiple_core_fields.rs index b96508e1c..60eb99013 100644 --- a/crates/ohno/examples/multiple_core_fields.rs +++ b/crates/ohno/examples/multiple_core_fields.rs @@ -7,6 +7,7 @@ use ohno::{Error, OhnoCore}; #[derive(Error)] struct MyError { + #[expect(dead_code, reason = "carried as data; the example is about disambiguating the core")] metadata: OhnoCore, #[error] // Mark the primary error field main_error: OhnoCore, diff --git a/crates/ohno/tests/constructor_integration.rs b/crates/ohno/tests/constructor_integration.rs index df4256408..61ba89e8d 100644 --- a/crates/ohno/tests/constructor_integration.rs +++ b/crates/ohno/tests/constructor_integration.rs @@ -28,6 +28,8 @@ fn test_complex_error_constructors() { } let db_err = DatabaseError::new("users", "SELECT"); + assert_eq!(db_err.table, "users"); + assert_eq!(db_err.operation, "SELECT"); assert_error_message!(db_err, "DatabaseError"); let db_err_with_error = DatabaseError::caused_by("users", "SELECT", "Table not found"); diff --git a/crates/ohno/tests/debug_implementation_comparison.rs b/crates/ohno/tests/debug_implementation_comparison.rs index 61985520c..a91a30500 100644 --- a/crates/ohno/tests/debug_implementation_comparison.rs +++ b/crates/ohno/tests/debug_implementation_comparison.rs @@ -19,7 +19,9 @@ fn test_named_struct_debug_structure() { pub(crate) struct TestNamedStruct { #[error] pub inner: OhnoCore, + #[expect(dead_code, reason = "read only by the generated Debug")] pub code: i32, + #[expect(dead_code, reason = "read only by the generated Debug")] pub message: String, } @@ -46,7 +48,11 @@ fn test_tuple_struct_debug_structure() { pub(crate) struct RefTupleStruct(pub OhnoCore, pub String, pub i32); #[derive(Error)] - pub(crate) struct TestTupleStruct(#[error] pub OhnoCore, pub String, pub i32); + pub(crate) struct TestTupleStruct( + #[error] pub OhnoCore, + #[expect(dead_code, reason = "read only by the generated Debug")] pub String, + #[expect(dead_code, reason = "read only by the generated Debug")] pub i32, + ); let ref_struct = RefTupleStruct(OhnoCore::from("error_content"), "additional_info".to_string(), 42); @@ -103,6 +109,7 @@ fn test_struct_with_enum_field_debug_structure() { struct TestEnumFieldStruct { #[error] error: OhnoCore, + #[expect(dead_code, reason = "read only by the generated Debug")] status: TestStatus, } diff --git a/crates/ohno/tests/derive_auto_debug.rs b/crates/ohno/tests/derive_auto_debug.rs index 9509d4e07..52e7d02d0 100644 --- a/crates/ohno/tests/derive_auto_debug.rs +++ b/crates/ohno/tests/derive_auto_debug.rs @@ -23,7 +23,10 @@ struct MultiFieldError { // Test tuple struct with automatic Debug #[derive(Error)] -struct TupleError(String, #[error] OhnoCore); +struct TupleError( + #[expect(dead_code, reason = "read only by the generated Debug")] String, + #[error] OhnoCore, +); // Test unit struct conversion with automatic Debug #[derive(Error)] diff --git a/crates/ohno_macros/docs/design.md b/crates/ohno_macros/docs/design.md index aee88658f..96a8eb848 100644 --- a/crates/ohno_macros/docs/design.md +++ b/crates/ohno_macros/docs/design.md @@ -250,6 +250,8 @@ trait `impl` carries all three, as does the single inherent `impl` holding the constructors. That covers lifetimes, type parameters and where clauses in one rule, which is what R1.3's "all of them carry the input's generics" asks for. +Every generated trait `impl` carries `#[automatically_derived]`. + Two values recur below: the core field's member, and the type's name as a string literal — the default message the runtime falls back to when nothing else renders. @@ -278,10 +280,12 @@ error type becomes infallible. including the core, so it iterates the full field list and branches once on style, into `debug_struct` for a named struct or `debug_tuple` for a tuple one. -It is the one generated item that is **not** `#[automatically_derived]`. -Dead-code analysis ignores field reads inside a derived `Debug`, so marking this -one would make every field that only `Debug` reads look unused in the user's own -crate. +`Debug` carries `#[rustc_trivial_field_reads]`, so marking this impl +`#[automatically_derived]` makes dead-code analysis discard its field reads. A +field that nothing but `Debug` reads is then reported, which is the answer +`#[derive(Debug)]` gives too. The core and any field the `#[display]` template +names stay live, because the other generated impls read them and their traits +carry no such attribute. **Constructors** are emitted unless the model suppresses them. `new` takes one parameter per non-core field and defaults the core; `caused_by` takes the same diff --git a/crates/ohno_macros_impl/src/derive_error/generate/constructors.rs b/crates/ohno_macros_impl/src/derive_error/generate/constructors.rs index c6ac36cac..1062805b7 100644 --- a/crates/ohno_macros_impl/src/derive_error/generate/constructors.rs +++ b/crates/ohno_macros_impl/src/derive_error/generate/constructors.rs @@ -37,7 +37,6 @@ pub(crate) fn generate(model: &Model) -> TokenStream { let caused_by_body = construct(&model.shape, &initializers(model, "e!(#core::from(error)))); quote! { - #[automatically_derived] impl #impl_generics #ident #ty_generics #where_clause { /// Creates the error with no source. #[allow(dead_code, reason = "generated for every error type, used at the author's discretion")] diff --git a/crates/ohno_macros_impl/src/derive_error/generate/traits.rs b/crates/ohno_macros_impl/src/derive_error/generate/traits.rs index 1cae3437d..49d1fe671 100644 --- a/crates/ohno_macros_impl/src/derive_error/generate/traits.rs +++ b/crates/ohno_macros_impl/src/derive_error/generate/traits.rs @@ -149,9 +149,7 @@ pub(crate) fn debug(model: &Model) -> TokenStream { }; quote! { - // Not `#[automatically_derived]`: dead-code analysis skips field reads in a derived - // `Debug`, so marking this one would make every field that only `Debug` reads look unused - // in the user's own crate. + #[automatically_derived] impl #impl_generics ::core::fmt::Debug for #ident #ty_generics #where_clause { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { #body diff --git a/crates/ohno_macros_impl/src/error_attr/mod.rs b/crates/ohno_macros_impl/src/error_attr/mod.rs index b2a48fb71..49f8cc275 100644 --- a/crates/ohno_macros_impl/src/error_attr/mod.rs +++ b/crates/ohno_macros_impl/src/error_attr/mod.rs @@ -101,13 +101,18 @@ fn inject_core(item: &mut ItemStruct) { } Fields::Unnamed(fields) => fields.unnamed.push(unnamed_core(&marker)), Fields::Unit => { + // Both tokens take the declaration's own span, so the rewritten struct stays in the + // caller's syntax context. Under call-site spans it would sit in this macro's context, + // where `dead_code` on it is discarded as external-macro code and a caller's + // `#[expect(dead_code)]` can never be fulfilled. + let span = item.ident.span(); let mut unnamed = FieldsUnnamed { - paren_token: syn::token::Paren::default(), + paren_token: syn::token::Paren(span), unnamed: syn::punctuated::Punctuated::new(), }; unnamed.unnamed.push(unnamed_core(&marker)); item.fields = Fields::Unnamed(unnamed); - item.semi_token = Some(::default()); + item.semi_token = Some(syn::Token![;](span)); } } } diff --git a/crates/ohno_macros_impl/tests/snapshots/public_api__a_from_attribute_generates_its_conversions.snap b/crates/ohno_macros_impl/tests/snapshots/public_api__a_from_attribute_generates_its_conversions.snap index bc9ac58b2..41e40e594 100644 --- a/crates/ohno_macros_impl/tests/snapshots/public_api__a_from_attribute_generates_its_conversions.snap +++ b/crates/ohno_macros_impl/tests/snapshots/public_api__a_from_attribute_generates_its_conversions.snap @@ -39,6 +39,7 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T") @@ -47,7 +48,6 @@ impl ::core::fmt::Debug for T { .finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -133,6 +133,7 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T") @@ -141,7 +142,6 @@ impl ::core::fmt::Debug for T { .finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -237,6 +237,7 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T") @@ -245,7 +246,6 @@ impl ::core::fmt::Debug for T { .finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -331,6 +331,7 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T") @@ -339,7 +340,6 @@ impl ::core::fmt::Debug for T { .finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -422,12 +422,12 @@ impl ::ohno::ErrorExt for T { self.1.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_tuple("T").field(&self.0).field(&self.1).finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -505,6 +505,7 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T") @@ -514,7 +515,6 @@ impl ::core::fmt::Debug for T { .finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( diff --git a/crates/ohno_macros_impl/tests/snapshots/public_api__a_numeric_argument_roots_at_a_tuple_field.snap b/crates/ohno_macros_impl/tests/snapshots/public_api__a_numeric_argument_roots_at_a_tuple_field.snap index b752ba5b0..76249982b 100644 --- a/crates/ohno_macros_impl/tests/snapshots/public_api__a_numeric_argument_roots_at_a_tuple_field.snap +++ b/crates/ohno_macros_impl/tests/snapshots/public_api__a_numeric_argument_roots_at_a_tuple_field.snap @@ -49,12 +49,12 @@ impl ::ohno::ErrorExt for T { self.1.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_tuple("T").field(&self.0).field(&self.1).finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -134,12 +134,12 @@ impl ::ohno::ErrorExt for T { self.1.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_tuple("T").field(&self.0).field(&self.1).finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -223,12 +223,12 @@ impl ::ohno::ErrorExt for T { self.1.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_tuple("T").field(&self.0).field(&self.1).finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( diff --git a/crates/ohno_macros_impl/tests/snapshots/public_api__a_positional_argument_is_scoped_to_self.snap b/crates/ohno_macros_impl/tests/snapshots/public_api__a_positional_argument_is_scoped_to_self.snap index 2be31194f..84c4bd2ae 100644 --- a/crates/ohno_macros_impl/tests/snapshots/public_api__a_positional_argument_is_scoped_to_self.snap +++ b/crates/ohno_macros_impl/tests/snapshots/public_api__a_positional_argument_is_scoped_to_self.snap @@ -53,6 +53,7 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T") @@ -62,7 +63,6 @@ impl ::core::fmt::Debug for T { .finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -162,6 +162,7 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T") @@ -171,7 +172,6 @@ impl ::core::fmt::Debug for T { .finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -271,6 +271,7 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T") @@ -280,7 +281,6 @@ impl ::core::fmt::Debug for T { .finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -380,6 +380,7 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T") @@ -389,7 +390,6 @@ impl ::core::fmt::Debug for T { .finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -489,6 +489,7 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T") @@ -498,7 +499,6 @@ impl ::core::fmt::Debug for T { .finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -598,6 +598,7 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T") @@ -607,7 +608,6 @@ impl ::core::fmt::Debug for T { .finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -703,6 +703,7 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T") @@ -712,7 +713,6 @@ impl ::core::fmt::Debug for T { .finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -812,6 +812,7 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T") @@ -821,7 +822,6 @@ impl ::core::fmt::Debug for T { .finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( diff --git a/crates/ohno_macros_impl/tests/snapshots/public_api__a_template_lowers_to_a_literal_or_a_format_call.snap b/crates/ohno_macros_impl/tests/snapshots/public_api__a_template_lowers_to_a_literal_or_a_format_call.snap index 8e4575891..35d91f94e 100644 --- a/crates/ohno_macros_impl/tests/snapshots/public_api__a_template_lowers_to_a_literal_or_a_format_call.snap +++ b/crates/ohno_macros_impl/tests/snapshots/public_api__a_template_lowers_to_a_literal_or_a_format_call.snap @@ -53,6 +53,7 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T") @@ -62,7 +63,6 @@ impl ::core::fmt::Debug for T { .finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -154,6 +154,7 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T") @@ -163,7 +164,6 @@ impl ::core::fmt::Debug for T { .finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -263,6 +263,7 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T") @@ -272,7 +273,6 @@ impl ::core::fmt::Debug for T { .finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -368,6 +368,7 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T") @@ -377,7 +378,6 @@ impl ::core::fmt::Debug for T { .finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -469,12 +469,12 @@ impl ::ohno::ErrorExt for T { self.1.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_tuple("T").field(&self.0).field(&self.1).finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -561,6 +561,7 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T") @@ -569,7 +570,6 @@ impl ::core::fmt::Debug for T { .finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( diff --git a/crates/ohno_macros_impl/tests/snapshots/public_api__an_argument_may_call_a_method_of_self.snap b/crates/ohno_macros_impl/tests/snapshots/public_api__an_argument_may_call_a_method_of_self.snap index 750b6777b..6d635550c 100644 --- a/crates/ohno_macros_impl/tests/snapshots/public_api__an_argument_may_call_a_method_of_self.snap +++ b/crates/ohno_macros_impl/tests/snapshots/public_api__an_argument_may_call_a_method_of_self.snap @@ -57,6 +57,7 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T") @@ -66,7 +67,6 @@ impl ::core::fmt::Debug for T { .finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -166,6 +166,7 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T") @@ -175,7 +176,6 @@ impl ::core::fmt::Debug for T { .finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -271,6 +271,7 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T") @@ -280,7 +281,6 @@ impl ::core::fmt::Debug for T { .finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( diff --git a/crates/ohno_macros_impl/tests/snapshots/public_api__every_struct_shape_generates_its_items.snap b/crates/ohno_macros_impl/tests/snapshots/public_api__every_struct_shape_generates_its_items.snap index 2ff86f329..44285b98b 100644 --- a/crates/ohno_macros_impl/tests/snapshots/public_api__every_struct_shape_generates_its_items.snap +++ b/crates/ohno_macros_impl/tests/snapshots/public_api__every_struct_shape_generates_its_items.snap @@ -38,6 +38,7 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T") @@ -46,7 +47,6 @@ impl ::core::fmt::Debug for T { .finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -118,12 +118,12 @@ impl ::ohno::ErrorExt for T { self.1.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_tuple("T").field(&self.0).field(&self.1).finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -191,12 +191,12 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T").field("inner", &self.inner).finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -269,6 +269,7 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T") @@ -278,7 +279,6 @@ impl ::core::fmt::Debug for T { .finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -360,12 +360,12 @@ impl ::ohno::ErrorExt for T { self.mine.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T").field("path", &self.path).field("mine", &self.mine).finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( diff --git a/crates/ohno_macros_impl/tests/snapshots/public_api__generics_thread_through_every_impl.snap b/crates/ohno_macros_impl/tests/snapshots/public_api__generics_thread_through_every_impl.snap index d0a4bb260..23d803502 100644 --- a/crates/ohno_macros_impl/tests/snapshots/public_api__generics_thread_through_every_impl.snap +++ b/crates/ohno_macros_impl/tests/snapshots/public_api__generics_thread_through_every_impl.snap @@ -39,6 +39,7 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T") @@ -48,7 +49,6 @@ impl ::core::fmt::Debug for T { .finish() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -129,6 +129,7 @@ impl<'a> ::ohno::ErrorExt for T<'a> { self.inner.backtrace() } } +#[automatically_derived] impl<'a> ::core::fmt::Debug for T<'a> { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T") @@ -137,7 +138,6 @@ impl<'a> ::core::fmt::Debug for T<'a> { .finish() } } -#[automatically_derived] impl<'a> T<'a> { /// Creates the error with no source. #[allow( @@ -227,6 +227,7 @@ where self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T where A: Clone, @@ -235,7 +236,6 @@ where f.debug_struct("T").field("a", &self.a).field("inner", &self.inner).finish() } } -#[automatically_derived] impl T where A: Clone, diff --git a/crates/ohno_macros_impl/tests/snapshots/public_api__the_suppressing_flags_remove_their_items.snap b/crates/ohno_macros_impl/tests/snapshots/public_api__the_suppressing_flags_remove_their_items.snap index 4ed4011e6..3e4c52ebe 100644 --- a/crates/ohno_macros_impl/tests/snapshots/public_api__the_suppressing_flags_remove_their_items.snap +++ b/crates/ohno_macros_impl/tests/snapshots/public_api__the_suppressing_flags_remove_their_items.snap @@ -38,7 +38,6 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } -#[automatically_derived] impl T { /// Creates the error with no source. #[allow( @@ -110,6 +109,7 @@ impl ::ohno::ErrorExt for T { self.inner.backtrace() } } +#[automatically_derived] impl ::core::fmt::Debug for T { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("T").field("inner", &self.inner).finish()