Skip to content
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

Remove TraitImplItem #2810

Merged
merged 1 commit into from
Jan 24, 2024
Merged

Remove TraitImplItem #2810

merged 1 commit into from
Jan 24, 2024

Conversation

powerboat9
Copy link
Collaborator

This moves us closer to unifying handling of associated items

gcc/rust/ChangeLog:

	* ast/rust-ast-full-decls.h
	(class TraitImplItem): Remove forward declaration.
	(class AssociatedItem): Add forward declaration.
	* ast/rust-ast.h
	(class TraitImplItem): Remove.
	(class TraitItem): Inherit from AssociatedItem.
	(SingleASTNode::take_trait_impl_item):
	Return std::unique_ptr<AssociatedItem> instead of
	std::unique_ptr<TraitImplItem>.
	* ast/rust-item.h
	(class Function): Inherit from AssociatedItem instead of
	TraitImplItem.
	(class TypeAlias): Likewise.
	(class ConstantItem): Likewise.
	(class TraitImpl): Store items as AssociatedItem.
	* expand/rust-derive-clone.cc
	(DeriveClone::clone_fn): Return std::unique_ptr<AssociatedItem>.
	(DeriveClone::clone_impl): Take std::unique_ptr<AssociatedItem>.
	* expand/rust-derive-clone.h
	(DeriveClone::clone_fn): Return std::unique_ptr<AssociatedItem>.
	(DeriveClone::clone_impl): Take std::unique_ptr<AssociatedItem>.
	* expand/rust-expand-visitor.cc
	(ExpandVisitor::visit): Handle changes to
	SingleASTNode::take_trait_impl_item.
	* parse/rust-parse-impl.h
	(Parser::parse_impl): Parse TraitImpl as containing AssociatedItem.
	(Parser::parse_trait_impl_item): Return
	std::unique_ptr<AssociatedItem>.
	(Parser::parse_trait_impl_function_or_method): Likewise.
	* parse/rust-parse.h
	(Parser::parse_trait_impl_item): Return
	std::unique_ptr<AssociatedItem>.
	(Parser::parse_trait_impl_function_or_method): Likewise.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
@P-E-P P-E-P self-requested a review January 23, 2024 07:56
@P-E-P P-E-P added this to the GCC 14.1 release milestone Jan 23, 2024
@P-E-P P-E-P requested a review from CohenArthur January 23, 2024 09:15
@braw-lee
Copy link
Contributor

I was working on another PR link, I want the Function class to inherit from TraitItem so we can remove TraitItemFunc and TraitItemMethod classes. Do you think it is a good idea? @powerboat9

@powerboat9
Copy link
Collaborator Author

I was thinking we should also remove TraitItem and replace it with AssociatedItem for the same reason

@braw-lee
Copy link
Contributor

this sounds better actually, I think I will wait for this PR to me merged and then work on #2811

@P-E-P P-E-P added this pull request to the merge queue Jan 24, 2024
Merged via the queue into Rust-GCC:master with commit 9a62272 Jan 24, 2024
@powerboat9 powerboat9 deleted the rem-2 branch January 24, 2024 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants