-
Notifications
You must be signed in to change notification settings - Fork 7
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
Strange error suggestions when deriving Diffus #104
Comments
I don't really know this lib but looking at the trait impls we have
so Not sure if there is a reason for not implementing it or if it can just be added to https://github.com/distil/diffus/blob/master/diffus/src/same.rs#L25 |
Indeed, Same for Vec<u8> is probably also pretty useful in general but my ticket was mostly about the strange suggestions in the derive macro roughly in the middle of the compiler output. |
Do you know if anything can be done about it in this lib? I guessed that this was just rustc trying its darndest to help out |
I am not familiar enough with the writing of macros to know what exactly causes it but presumably the suggestion is propagated from some type in the generated code to that place. Something like cargo-expand might be useful to get some more information on the cause and possibly minimize the example to report it to the compiler issue tracker if necessary. |
Great find @taladar ! Thought about it for a few minutes I don't see any reason for not having it as a default implementation. str does already have a default Same using Eq, so String should too to be "least surprising" If you need an alternative "sameness" you'll have to wrap it in it's own type. Added a test and fixed it: |
I am trying to derive Diffus on the following data type
which gives me some strange suggestions in the error it produces (on Rust 1.57.0)
I am reasonably sure that neither &Diffus nor Box make sense in the derive macro parameters?
Changing it to &Diffus experimentally yields
The text was updated successfully, but these errors were encountered: