Skip to content

Conversation

@sqrtM
Copy link

@sqrtM sqrtM commented Dec 26, 2025

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.

Commit 1 Fixes #4235. Commit 4 also corrects an unrelated inconsistency with how create-level traits throw errors.

Commits 2+3 are a small refactor and not at all necessary for the correct functioning of the other commits. If they're not to anyone's liking they can be swiftly dropped 🙏 . I only added them because, in light of the changes made in commit 1, it seemed logical to drop the loops and their associated functions.

Thanks a bunch and happy holidays 🎉

@sqrtM sqrtM changed the title Improve attribute validation #4235 Improve attribute validation Rust-GCC/gccrs#4242 Dec 26, 2025
@sqrtM sqrtM force-pushed the mason/diags branch 2 times, most recently from e90e4de to 4d45489 Compare December 26, 2025 17:01
@sqrtM
Copy link
Author

sqrtM commented Dec 26, 2025

(sorry for the ci spam 🙇 , my ChangeLog wasn't correctly formatted ; didn't realize there was a script to check in the contrib/ + all the gnu specific stuff until it was too late. I'll probably make a pr to add a few words about that to Contributing.md once this is done, to help out the next person)

anyway, thanks a lot to whomever reviews this 👍

@sqrtM sqrtM changed the title Improve attribute validation Rust-GCC/gccrs#4242 Improve attribute validation Rust-GCC/gccrs#4235 Jan 5, 2026
@P-E-P P-E-P self-requested a review January 7, 2026 11:22
@@ -0,0 +1,2 @@
#[target_feature] // { dg-error "the ...target_feature.. attribute may only be applied to functions" }
Copy link
Member

Choose a reason for hiding this comment

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

You'll need to change that attribute to something like #[target_feature(enable = "")] otherwise a second error will get thrown and won't be matched, the CI will complain about it.

Copy link
Author

Choose a reason for hiding this comment

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

absolutely right, sorry about that ; silly oversight on my part.

changes are up and CI looks green.

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.

LGTM, thank you!

@P-E-P P-E-P added this pull request to the merge queue Jan 12, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Jan 12, 2026
@P-E-P
Copy link
Member

P-E-P commented Jan 13, 2026

@sqrtM Would you please rebase your branch on top of master ? I really like your changes and would like to merge them

@sqrtM
Copy link
Author

sqrtM commented Jan 13, 2026

absolutely. I'll get on that as soon as I can this week. Unfortunately, all my tests are failing after the rebase ; trying to figure out where that's coming from but I don't have any time left today to really crack into that. I'll see if I can't find some time to fix that up this weekend.

thanks again

sqrtM added 4 commits January 18, 2026 12:49
fixes Rust-GCC#4235

gcc/rust/ChangeLog:
	* util/rust-attributes.cc: add new function to validate that an
	attribute is assigned to a valid item type

gcc/testsuite/ChangeLog:
	* rust/compile/issue-4232.rs: update expected error to include
	the specific illegal attribute

Signed-off-by: Mason Pike <[email protected]>
gcc/rust/ChangeLog:
	* util/rust-attributes.cc: factor out loops from
	several functions to prevent us from having to loop
	several times over the same attributes

Signed-off-by: Mason Pike <[email protected]>
gcc/rust/ChangeLog:
	* util/rust-attributes.cc: remove loop helper functions
	* util/rust-attributes.h: remove function defs

Signed-off-by: Mason Pike <[email protected]>
gcc/rust/ChangeLog:
	* util/rust-attributes.cc: add attributes to the __outer_attributes set.
	This prevents some inconsistent behavior, like: https://godbolt.org/z/Eq1GE7xxY

Signed-off-by: Mason Pike <[email protected]>
@sqrtM
Copy link
Author

sqrtM commented Jan 18, 2026

@P-E-P sorry for the wait; busy start to the year.

rebase is good and ci is green. only violent part of the rebase is here ; just moved the logic for REPR into the general "check_for_valid_attr" function.

thanks a bunch ; have a nice sunday!

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.

target_feature attribute should only be applied to functioms

2 participants