-
-
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
Add required bounds to derived impl #421
base: main
Are you sure you want to change the base?
Add required bounds to derived impl #421
Conversation
This should be mostly good, I'll add some tests but I'd appreciate a comment-type review in the meantime if possible :) |
ok tests are now there as well (thought I would do it later but I noticed |
Oh and I just noticed since I added an explicit to_owned instead of just relying on an implicit copy for the label (I think, should test, maybe add a unit test for that?) #377 should work just fine as well. Since |
Putting it behind a feature flag seems wise, yes. |
Hi, as I am in the process of moving right now I will probably only get back to this the next weekend or so, but my current plan for this is:
And finally, after all this is done I should probably prepare a change log entry, so I am going to do that as well. If that sounds like a reasonable plan feel free to let me know what you think (or any other things I should do) otherwise I would just go ahead with that plan once I've got some more time to work on this ( as I've mentioned probably around next weekend ) |
( accidentally pressed the close button, sorry for the noise ) |
This is implemented using a new TypeBoundsStore struct which tracks usage of types during parsing and stores required bounds for generics, trying to use some heuristics to remove unneeded bounds. Signed-off-by: Justus Fluegel <[email protected]> Signed-off-by: Justus Flügel <[email protected]>
Signed-off-by: Justus Fluegel <[email protected]> Signed-off-by: Justus Flügel <[email protected]>
…ementation strictly more flexible using to_owned over clone Signed-off-by: Justus Fluegel <[email protected]> Signed-off-by: Justus Flügel <[email protected]>
661f537
to
e35e69e
Compare
Signed-off-by: Justus Flügel <[email protected]>
… can't format Signed-off-by: Justus Flügel <[email protected]>
Signed-off-by: Justus Flügel <[email protected]>
Signed-off-by: Justus Flügel <[email protected]>
e35e69e
to
ea48010
Compare
This is an attempt to make the derive macro for
Diagnostic
work better with generics, allowing to write code like for exampleThis should for example make #162 just work, as well as things like
and the other supported attributes.
AFAIK the only gotcha with this implementation right now is that
#[related]
only works with concrete collection types and not with generic collections, but the type inside the collection can be generic. (meaning:Vec<T>
works but not any arbitraryC
whereC: IntoIter<Item: Diagnostic>
), and I think that is a current limitation of the rust compiler / the current Diagnostic trait design.Questions: Do we want to gate this behind a feature flag since it pulls in extra-traits from syn and performs a bunch of extra work?