Skip to content

Commit 1754825

Browse files
committed
Work around trivial bounds being unstable
1 parent 1567f40 commit 1754825

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

impl/src/expand.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ fn fallback(input: &DeriveInput, error: syn::Error) -> TokenStream {
3838
#[allow(unused_qualifications)]
3939
impl #impl_generics std::error::Error for #ty #ty_generics #where_clause
4040
where
41-
#ty #ty_generics: ::core::fmt::Debug,
41+
// Work around trivial bounds being unstable.
42+
// https://github.com/rust-lang/rust/issues/48214
43+
for<'workaround> #ty #ty_generics: ::core::fmt::Debug,
4244
{}
4345

4446
#[allow(unused_qualifications)]

tests/ui/union.stderr

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,3 @@ error: union as errors are not supported
66
6 | | num: usize,
77
7 | | }
88
| |_^
9-
10-
error[E0277]: `U` doesn't implement `Debug`
11-
--> tests/ui/union.rs:3:10
12-
|
13-
3 | #[derive(Error)]
14-
| ^^^^^ `U` cannot be formatted using `{:?}`
15-
|
16-
= help: the trait `Debug` is not implemented for `U`
17-
= note: add `#[derive(Debug)]` to `U` or manually `impl Debug for U`
18-
= help: see issue #48214
19-
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
20-
= note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info)
21-
help: consider annotating `U` with `#[derive(Debug)]`
22-
|
23-
4 + #[derive(Debug)]
24-
5 | pub union U {
25-
|

0 commit comments

Comments
 (0)