-
Notifications
You must be signed in to change notification settings - Fork 187
Add derived
flag to item
#4028
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 derived
flag to item
#4028
Conversation
gcc/rust/ChangeLog: * ast/rust-ast.h: Add derived flag to Item. * hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_extern_block): Add derived flag to Item. * hir/rust-ast-lower-enumitem.h: Add derived flag to Item. * hir/rust-ast-lower-implitem.cc (ASTLowerImplItem::visit): Add derived flag to Item. * hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Add derived flag to Item. * hir/tree/rust-hir-item.cc: Add derived flag to Item. * hir/tree/rust-hir-item.h: Add derived flag to Item. Signed-off-by: Ryutaro Okada <[email protected]>
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.
This LGTM but lets see what @P-E-P and @CohenArthur say.
Another option to avoid changing the HIR could be to make a std::map<NodeId, bool AST::Item&
in the rust-mappings.h and during hir lowering you can look that up to determine if an ITEM was derived.
But yeah see what the guys think.
Why distinguish? Producing better errors for derive-generated code? |
A set instead of a |
yeah sounds like if you need this flag then follow @P-E-P advice |
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.
change this to use a map and loop instead
|
I will close this PR and create a new issue because the implementation is entirely different. |
To distinguish between items that are automatically generated by #[derive()] and those that aren't, I added a derived flag to Item.
make check-rust
passes locallyclang-format