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

Fix pub type parsing in trait #2720

Merged
merged 2 commits into from
Nov 21, 2023

Conversation

P-E-P
Copy link
Member

@P-E-P P-E-P commented Nov 2, 2023

We shall be able to parse public trait items even if those will be rejected during the AST validation pass later. This PR introduces some changes for associated trait types.

Fixes #2666

@P-E-P P-E-P added this to the GCC 14.1 release milestone Nov 2, 2023
@P-E-P P-E-P self-assigned this Nov 2, 2023
@P-E-P P-E-P marked this pull request as ready for review November 2, 2023 16:36
The compiler shall parse visibility modifiers on trait items and reject
those at a later stage (ast validation).

gcc/rust/ChangeLog:

	* ast/rust-item.h (struct Visibility): Move Visibility from here...
	* ast/rust-ast.h (struct Visibility): ...to here.
	* parse/rust-parse-impl.h (Parser::parse_trait_item): Parse visibility
	before giving it back to the item parsing function.
	(Parser::parse_trait_type): Add visibility modifier.
	* parse/rust-parse.h (RUST_PARSE_H): Change function prototype.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
This new test highlight the parser's behavior around public trait types.

gcc/testsuite/ChangeLog:

	* rust/compile/trait_pub_type.rs: New test.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
@P-E-P P-E-P force-pushed the fix-pub-type-parsing-in-trait branch from b386f01 to 3b37d59 Compare November 20, 2023 09:41
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.

nice :)

@P-E-P P-E-P added this pull request to the merge queue Nov 21, 2023
Merged via the queue into Rust-GCC:master with commit 03c6549 Nov 21, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Cannot parse disabled pub type
2 participants