Skip to content

gccrs: Fix TupleStructPattern compilation throwing error#3850

Merged
philberty merged 1 commit into
Rust-GCC:masterfrom
Polygonalr:tuple-struct-pattern
Jun 23, 2025
Merged

gccrs: Fix TupleStructPattern compilation throwing error#3850
philberty merged 1 commit into
Rust-GCC:masterfrom
Polygonalr:tuple-struct-pattern

Conversation

@Polygonalr

Copy link
Copy Markdown
Contributor

Compilation of non-enum TupleStructPattern will result in an error, this PR fixes it.

@philberty philberty left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

code LGTM but can you add an extra line in your commit message describing the patch here. One line is enough.

Code for TupleStructPattern compilation previously only assumes that it is derived from
an enum. This commit adds a check for that, and compiles non-enum TupleStructPatterns
similarly to TuplePatterns if it is not an enum.

gcc/rust/ChangeLog:

	* backend/rust-compile-pattern.cc(CompilePatternCheckExpr::visit(TupleStructPattern)):
		Fix error thrown when compiling non-enum TupleStructPattern.

Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
@Polygonalr Polygonalr force-pushed the tuple-struct-pattern branch from 4b2097c to 5aa619f Compare June 23, 2025 03:40
@Polygonalr Polygonalr requested a review from philberty June 23, 2025 03:40

@philberty philberty left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM nice work

@philberty philberty added this pull request to the merge queue Jun 23, 2025
Merged via the queue into Rust-GCC:master with commit a3d751f Jun 23, 2025
12 checks passed
@Polygonalr Polygonalr deleted the tuple-struct-pattern branch August 2, 2025 06:53
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.

2 participants