]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: Fix StructPattern type checking rejecting tuple struct scrutinee
authorYap Zhi Heng <yapzhhg@gmail.com>
Sun, 28 Sep 2025 11:11:31 +0000 (19:11 +0800)
committerArthur Cohen <arthur.cohen@embecosm.com>
Thu, 30 Oct 2025 20:30:53 +0000 (21:30 +0100)
commite13277e56ec2c19b2cbc598ea5bbc31747367600
treeda9ea286d0888badfefa29c21d5d54d4c7160808
parent54ff78002e744490ac8b900a3e6282993eb86846
gccrs: Fix StructPattern type checking rejecting tuple struct scrutinee

Previously, type checking of StructPattern will throw an error if it is used
to match against a tuple struct, even though it is possible to do so in rustc.

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-pattern.cc (visit(StructPattern)): Add type check
support for StructPatterns matching against a TUPLE type ADT.
* backend/rust-compile-pattern.cc(CompilePatternBindings::visit(StructPattern)):
Update assert to allow TUPLE type ADTs.
* hir/tree/rust-hir.cc (StructPatternField::as_string()): Improve info dumped.

Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
gcc/rust/backend/rust-compile-pattern.cc
gcc/rust/hir/tree/rust-hir.cc
gcc/rust/typecheck/rust-hir-type-check-pattern.cc