-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve derive-Display trait bounds inference (#93) #95
Improve derive-Display trait bounds inference (#93) #95
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems nice! 👍
Tested on a real project, works as expected.
Implemented proper trait bounds inference for reference types as suggested by @tyranron in discussion in #93. |
Can you add a test for the reference types? |
Thanks for the work! I'll take a look at it in the near future
…On Wed, 23 Oct 2019, 11:08 Roman Titov, ***@***.***> wrote:
@JelteF <https://github.com/JelteF>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#95?email_source=notifications&email_token=AAI3YJRS2B3Q6GSP2Q7KPHLQQAH7XA5CNFSM4JC3YWG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECAVMXA#issuecomment-545347164>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAI3YJV65ZX6ONG47ICJK7TQQAH7XANCNFSM4JC3YWGQ>
.
|
This is now released as version 0.99.0. Announcement link: https://www.reddit.com/r/rust/comments/duptc0/derive_more_0990_released_biggest_release_ever/ |
First half of #93.
Modified
Display
macro, so that for each field of the following types or of reference tosuch types a where clause is generated bounding field's type by
Display
trait:T
T::AssociatedType
and<T as Trait>::AssociatedType
::path::SomeOtherType<T>
and::path::SomeOtherType<&T>
E.g., for a structure
Foo
defined like this:Following where clauses would be generated (notice, that for reference types the
referred type is bound):
T1: Display
<T2 as Trait>::Type: Display
Bar<T3>: Display
As far as I understand, as we can't define
Display
for pointers, arrays, slices and tuples, adding bounds for such types (or any generic types parametrized by such types, e.g.,SomeType<[T; 10]>
) would be wrong.