Skip to content

Conversation

@lucasly-ba
Copy link

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!

{Attrs::PROC_MACRO_ATTRIBUTE, EXPANSION},

{Attrs::DERIVE, EXPANSION},
= {{Attrs::INLINE, CODE_GENERATION, false},
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be better to add a second map here rather than add a boolean attribute to every BuiltinAttrDefinition

@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 <lucas.ly-ba@outlook.com>
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.

Every bad inner attributes should show an error

2 participants