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

refactor all attribute functions in rust-compile-base.cc #3336

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

saeitoshi-10
Copy link
Contributor

@saeitoshi-10 saeitoshi-10 commented Dec 31, 2024

gcc/rust/ChangeLog:
* backend/rust-compile-base.cc (get_attributes):removed checker function (get_trait_name):removed checker function
* util/rust-attributes.cc (Attributes::get_attributes):added checker function (Attributes::get_trait_name): added checker function
* util/rust-attributes.h: added functions definitions in the header file for access

Thank you for making Rust GCC better!

If your PR fixes an issue, you can add "Fixes #issue_number" into this
PR description and the git commit message. This way the issue will be
automatically closed when your PR is merged. If your change addresses
an issue but does not fully fix it please mark it as "Addresses #issue_number"
in the git commit message.

Here is a checklist to help you with your PR.

Note that you can skip the above if you are just opening a WIP PR in
order to get feedback.

Addresses : #3291
*Please write a comment explaining your change. This is the message
that will be part of the merge commit.

	* backend/rust-compile-base.cc (get_attributes):removed checker function
	(get_trait_name):removed checker function
	* util/rust-attributes.cc (Attributes::get_attributes):added checker function
	(Attributes::get_trait_name): added checker function
	* util/rust-attributes.h: added functions definitions in the header file for access

Signed-off-by: Om Swaroop Nayak <[email protected]>
@powerboat9
Copy link
Contributor

Are you trying to use those functions elsewhere in the codebase?

@saeitoshi-10
Copy link
Contributor Author

no i didn't see any other implementations till but if it exists i'll be sure to replace that

@philberty philberty requested a review from P-E-P January 10, 2025 11:30
Copy link
Member

@philberty philberty left a comment

Choose a reason for hiding this comment

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

This seems fine but not 100% sure probably best to ask @P-E-P iirc did this code sometimes its useful to keep stuff thats associated local i am fine with it if others are

@philberty
Copy link
Member

@saeitoshi-10 merge conflicts this needs rebased

@@ -29,6 +29,8 @@ class Attributes
{
public:
static bool is_known (const std::string &attribute_path);
static std::string get_trait_name (const AST::Attribute &attr);
Copy link
Member

Choose a reason for hiding this comment

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

I'm not keen to adding those functions in the attribute class as here attribute means two different things. The first one is the attribute as we all know it in rust #[attribute] (1), but the second one is specific to proc macros (2). On one hand moving it inside the attribute class seems appropriate because it is indeed part of proc macro declaration which are attributes(1) but on the other hand it might confuse people as it really only works for (2)

Copy link
Member

@P-E-P P-E-P left a comment

Choose a reason for hiding this comment

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

You need to amend your commit message. Right now you've kept the autogenerated commit message which is great. But a commit message should contain more than that.

GCC uses the usual convention that can be found in most projects, one short title (max 50 columns), it should contain keywords to easily identify the commit among others.

Then a blank line.

And then a description about why the commit has been introduced, why it exists and even why those changes are done this way. This section should be wrapped at 72 columns.

Then I usually leave another blank line and keep the generated changelog structure filled with what has been changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Review in progress
Development

Successfully merging this pull request may close these issues.

4 participants