diff --git a/impl/src/expand.rs b/impl/src/expand.rs index 13c5fb3..4ce2c0b 100644 --- a/impl/src/expand.rs +++ b/impl/src/expand.rs @@ -38,7 +38,9 @@ fn fallback(input: &DeriveInput, error: syn::Error) -> TokenStream { #[allow(unused_qualifications)] impl #impl_generics std::error::Error for #ty #ty_generics #where_clause where - #ty #ty_generics: ::core::fmt::Debug, + // Work around trivial bounds being unstable. + // https://github.com/rust-lang/rust/issues/48214 + for<'workaround> #ty #ty_generics: ::core::fmt::Debug, {} #[allow(unused_qualifications)] diff --git a/tests/ui/union.stderr b/tests/ui/union.stderr index 8a07ae6..3ec4d71 100644 --- a/tests/ui/union.stderr +++ b/tests/ui/union.stderr @@ -6,20 +6,3 @@ error: union as errors are not supported 6 | | num: usize, 7 | | } | |_^ - -error[E0277]: `U` doesn't implement `Debug` - --> tests/ui/union.rs:3:10 - | -3 | #[derive(Error)] - | ^^^^^ `U` cannot be formatted using `{:?}` - | - = help: the trait `Debug` is not implemented for `U` - = note: add `#[derive(Debug)]` to `U` or manually `impl Debug for U` - = help: see issue #48214 - = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable - = note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider annotating `U` with `#[derive(Debug)]` - | -4 + #[derive(Debug)] -5 | pub union U { - |