gccrs: fix bug in pattern check for tuples
commit72a0554c7a269efeb6bb5462c3968f40fdf88fc2
authorPhilip Herron <herron.philip@googlemail.com>
Sun, 4 Feb 2024 17:07:05 +0000 (4 17:07 +0000)
committerArthur Cohen <arthur.cohen@embecosm.com>
Wed, 7 Feb 2024 11:40:23 +0000 (7 12:40 +0100)
tree63516a847fe50c6b153f806f40fc19f6c9d1f77c
parentae2f70932225634d38f8ee21a5d9bdcc91296425
gccrs: fix bug in pattern check for tuples

We can point to generic parent types which means we need to do the shallow
resolve thing that rustc does. We have destructure which is similar to get
what the parameter type points to.

Fixes #2775

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): use destructure

gcc/testsuite/ChangeLog:

* rust/compile/issue-2775.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/typecheck/rust-hir-type-check-pattern.cc
gcc/testsuite/rust/compile/issue-2775.rs [new file with mode: 0644]