Work around trivial bounds being unstable

This commit is contained in:
David Tolnay 2023-12-15 14:04:35 -08:00
parent 1567f40ec3
commit 1754825c24
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
2 changed files with 3 additions and 18 deletions

View File

@ -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)]

View File

@ -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 {
|