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

Add AST union validation #2750

Merged
merged 1 commit into from
Nov 21, 2023
Merged

Add AST union validation #2750

merged 1 commit into from
Nov 21, 2023

Conversation

P-E-P
Copy link
Member

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

Unions with zero fields are forbidden.

@P-E-P P-E-P added this to the GCC 14.1 release milestone Nov 20, 2023
@P-E-P P-E-P self-assigned this Nov 20, 2023
@P-E-P P-E-P requested a review from CohenArthur November 20, 2023 14:59
@P-E-P P-E-P marked this pull request as ready for review November 20, 2023 14:59
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.

LGTM, one nit since all other nodes have long proper names

gcc/rust/checks/errors/rust-ast-validation.cc Outdated Show resolved Hide resolved
Unions with zero fields are forbidden. Add regression test for empty
unions.

gcc/rust/ChangeLog:

	* checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add
	zero field check during ast validation pass.
	* checks/errors/rust-ast-validation.h: Add union visit function
	prototype.

gcc/testsuite/ChangeLog:

	* rust/compile/const_generics_8.rs: Fill the union with dummy values.
	* rust/compile/empty_union.rs: New test.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
@P-E-P P-E-P enabled auto-merge November 21, 2023 12:13
@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 546e251 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.

2 participants