Skip to content

Commit

Permalink
Work around trivial bounds being unstable
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Dec 15, 2023
1 parent 1567f40 commit 1754825
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
4 changes: 3 additions & 1 deletion impl/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
17 changes: 0 additions & 17 deletions tests/ui/union.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
|

0 comments on commit 1754825

Please sign in to comment.