Skip to content

Conversation

sakupan102
Copy link
Contributor

@sakupan102 sakupan102 commented Aug 8, 2025

Instead of adding derived flag to AST node, I use a set to collect derived nodes. I distinguish between items that are automatically generated by #[derive()] and those that aren't with this set.

old PR: #4028

@@ -1358,5 +1358,17 @@ Mappings::lookup_captures (NodeId closure)
return cap->second;
}

void
Mappings::add_derived_nodes (NodeId node_id)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be add_derived_node (not plural)

@powerboat9
Copy link
Collaborator

Otherwise, looks good

gcc/rust/ChangeLog:

	* expand/rust-expand-visitor.cc (builtin_derive_item): Collect derived nodes.
	(derive_item): Collect derived nodes.
	* util/rust-hir-map.cc (Mappings::add_derived_nodes): Add derived set to collect derived
	nodes.
	(Mappings::is_derived_node): Add derived set to collect derived nodes.
	* util/rust-hir-map.h: Add derived set to collect derived nodes.

Signed-off-by: Ryutaro Okada <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants