Closed
Description
Both of the following generate a working impl:
#[derive(Display)]
#[display("{thing}")]
struct Struct<T> {
thing: T, // generic
}
#[derive(Display)]
#[display("{thing}")]
struct Struct {
r#thing: i32, // raw
}
but this generates an impl that does not compile.
#[derive(Display)]
#[display("{thing}")]
struct Struct<T> {
r#thing: T, // raw, generic
}
error[E0277]: `T` doesn't implement `derive_more::Display`
--> src/main.rs:3:10
|
3 | #[derive(Display)]
| ^^^^^^^ `T` cannot be formatted with the default formatter
|
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
= note: required for `&T` to implement `derive_more::Display`
= note: this error originates in the derive macro `Display` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `T` with trait `Display`
|
5 | struct Struct<T: derive_more::Display> {
| ++++++++++++++++++++++
Activity