util/attributes: Check that #[target_feature] is only used on unsafe …#4356
Merged
P-E-P merged 1 commit intoRust-GCC:masterfrom Jan 15, 2026
Merged
Conversation
6e8d514 to
3285e5d
Compare
Member
|
Thanks for your contribution! A bit similar as my other comment in your other PR, can you be more precise in the changelog and clearly identify which member you have modifying? ? |
Contributor
Author
|
thanks for the review . will change all the commit messages to be more precise in the changelog. |
3285e5d to
212d55f
Compare
Contributor
Author
|
drafted to resolve merge conflicts |
4ce4e1e to
23c54b8
Compare
40f8d23 to
c2e0bc6
Compare
Contributor
Author
|
@P-E-P please review . thankyou . |
P-E-P
approved these changes
Jan 14, 2026
P-E-P
reviewed
Jan 14, 2026
Member
There was a problem hiding this comment.
I'd prefer a clearer message in the changelog rather than simply "modified"
* util/rust-attributes.cc (AttributeChecker::visit): modified.
This part will be extracted from the commit and will lack the context. Please add what has changed. Otherwise LGTM.
…functions The #[target_feature] attribute allows code generation that may not be supported by the runtime hardware, making it inherently unsafe. This patch adds a check to ensure it is only applied to functions declared as 'unsafe', matching rustc behavior (E0658). Fixes Rust-GCC#4234 gcc/rust/ChangeLog: * util/rust-attributes.cc (AttributeChecker::visit): Reject #[target_feature] on non-unsafe functions. gcc/testsuite/ChangeLog: * rust/compile/issue-4234.rs: New test. * rust/compile/unsafe11.rs: Mark function as unsafe to to satisfy new #[target_feature] restriction. Signed-off-by: Jayant Chauhan <0001jayant@gmail.com>
c2e0bc6 to
b18c4db
Compare
Contributor
Author
|
@P-E-P , commit message updated . thankyou . |
P-E-P
approved these changes
Jan 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The #[target_feature] attribute allows code generation that may not be supported by the runtime hardware, making it inherently unsafe. This patch adds a check to ensure it is only applied to functions declared as 'unsafe', matching rustc behavior (E0658).
Fixes #4234
gcc/rust/ChangeLog:
gcc/testsuite/ChangeLog: