-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[Merged by Bors] - Enable deriving Reflect on structs with generic types #7364
Closed
cBournhonesque
wants to merge
10
commits into
bevyengine:main
from
cBournhonesque:cb/add-bound-derive-reflect
Closed
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1e3ecec
add Reflect and Typed bounds when reflecting on a struct that has gen…
cbournhonesque-sc b52b07a
apply rustfmt
cbournhonesque-sc 76c1c93
create where_clause utility function, handle ignored generics
cbournhonesque-sc d59789b
nit
cbournhonesque-sc b88b04f
address comments
cbournhonesque-sc e50062b
fix clippy
cbournhonesque-sc b7c0c8b
remove de-duplication
cbournhonesque-sc a953884
fix doc
cbournhonesque-sc 2a68dbd
Merge remote-tracking branch 'upstream/main' into cb/add-bound-derive…
cbournhonesque-sc e71b472
address comments
cbournhonesque-sc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can we remove this import and just fully qualify the usages in code? It mainly helps to differentiate between
proc_macro::TokenStream
andproc_macro2::TokenStream
without having to check the imports.We may revisit and decide this practice is not really needed, but just to help keep things consistent for now, we should change it.
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.
We can; but in general I think the common practice is to
use proc_macro2::TokenStream
everywhere (since it's the one that is compatible withsyn
andquote
) and only at the very last stage convert into aproc_macro::TokenStream
.See for example: https://github.com/serde-rs/serde/tree/master/serde_derive/src
I think most crates have this model; where
proc_macro::TokenStream
is the only one that is explicitly spelled out and not imported (and is normally only used inlib.rs
when the final macro is put together)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.
Basically, I think that
use proc_macro2::TokenStream
should be used everywhere by default (since it's the one we apply ops on), and then we just callproc_macro::TokenStream
when needed. But this can be left to another PR, ot unblock this oneThere 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.
Yeah I agree, it makes more sense to flip it. But just for consistency until a cleanup PR comes along to handle it, we should try to keep it consistent