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

Allow matching on non-enum ADTs #2978

Merged
merged 1 commit into from
May 16, 2024
Merged

Allow matching on non-enum ADTs #2978

merged 1 commit into from
May 16, 2024

Conversation

powerboat9
Copy link
Contributor

No description provided.

@powerboat9
Copy link
Contributor Author

powerboat9 commented May 3, 2024

Couldn't find #2906 until just now, so I didn't notice that this duplicates much of #2958

@P-E-P
Copy link
Member

P-E-P commented May 15, 2024

Couldn't find #2906 until just now, so I didn't notice that this duplicates much of #2958

We merged the other PR however it misses the non enum variant number test. Would you rebase this PR on master so we could integrate your test as well as the missing changes ?

@P-E-P P-E-P self-requested a review May 15, 2024 14:34
gcc/rust/ChangeLog:

	* backend/rust-compile-expr.cc
	(check_match_scrutinee): Add assertion.
	* backend/rust-compile-pattern.cc
	(CompilePatternCheckExpr::visit):
	Handle HIR::PathInExpression matching a non-enum.

gcc/testsuite/ChangeLog:

	* rust/compile/match-struct-path.rs: New test.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
@powerboat9
Copy link
Contributor Author

Rebased

Copy link
Member

@P-E-P P-E-P left a comment

Choose a reason for hiding this comment

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

LGTM!

@P-E-P P-E-P added this pull request to the merge queue May 16, 2024
Merged via the queue into Rust-GCC:master with commit 1c52754 May 16, 2024
9 checks passed
@powerboat9 powerboat9 deleted the variant branch May 17, 2024 01:30
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