Skip to content

Conversation

@lucasly-ba
Copy link
Contributor

Fixes #4219

gcc/rust/ChangeLog:

* ast/rust-ast.cc (Attribute::is_derive): Change is_derive method with its valid path.
* util/rust-attribute-values.h: Delete redudant derive attribute.
* util/rust-attributes.cc (AttributeChecker::check_inner_attribute): Give can_be_inner a value for each atribute. (AttributeChecker::check_inner_attributes): Implement method for errors check.
* util/rust-attributes.h (struct BuiltinAttrDefinition): Add can_be_inner object in struct.

gcc/testsuite/ChangeLog:

* rust/compile/issue-4212.rs:

Copy link
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

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

I think just add another map instead of reusing the existing one and we will merge this :) good job!

@lucasly-ba lucasly-ba force-pushed the 4219 branch 3 times, most recently from 2ff2487 to 8098c3b Compare November 3, 2025 17:51
gcc/rust/ChangeLog:

	* ast/rust-ast.cc (Attribute::is_derive):
	Change is_derive method with its valid path.
	* util/rust-attribute-values.h:
	Delete redudant derive attribute.
	* util/rust-attributes.cc (AttributeChecker::check_inner_attribute):
	Helper method for check_inner_attributes
	(AttributeChecker::check_inner_attributes):
	Implement method for errors check.
	* util/rust-attributes.h:
	Add methods above in header.

gcc/testsuite/ChangeLog:

	* rust/compile/issue-4212.rs:
	* rust/compile/issue-4219.rs: New test.

Signed-off-by: Lucas Ly Ba <[email protected]>
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.

LGTM

@philberty philberty added diagnostic diagnostic static analysis AST labels Nov 9, 2025
@github-project-automation github-project-automation bot moved this to In progress in Project Pineapple Nov 9, 2025
@philberty philberty added this pull request to the merge queue Nov 9, 2025
Merged via the queue into Rust-GCC:master with commit 24ed1a3 Nov 9, 2025
13 checks passed
@github-project-automation github-project-automation bot moved this from In progress to Done in Project Pineapple Nov 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AST diagnostic diagnostic static analysis

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Every bad inner attributes should show an error

3 participants