]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: [E0164] Neither tuple struct nor tuple variant used as a pattern
authorMuhammad Mahad <mahadtxt@gmail.com>
Wed, 16 Aug 2023 12:40:09 +0000 (17:40 +0500)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 18:00:31 +0000 (19:00 +0100)
commitcdddf7baff74af1542788868d1cfab6dc435f2ef
treeadd07d913086d23ecab5d6dfe5c5bb4b7f1c4393
parent87ccd32da00e82584215c759e80bd092003c9efb
gccrs: [E0164] Neither tuple struct nor tuple variant used as a pattern

Checking if pattern has items, before returing solves ICE.
Added error code and rich location.
Also, fixes https://github.com/Rust-GCC/gccrs/issues/2430

gcc/rust/ChangeLog:

* ast/rust-pattern.h: No need of assertion, we are handling it.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit):
Added check which emits error instead of using assertion.
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit):
Added rich location and error code.

gcc/testsuite/ChangeLog:

* rust/compile/match5.rs:
Updated comment for dejagnu.
* rust/compile/pattern-struct.rs: New test for ICE.

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
gcc/rust/ast/rust-pattern.h
gcc/rust/resolve/rust-early-name-resolver.cc
gcc/rust/typecheck/rust-hir-type-check-pattern.cc
gcc/testsuite/rust/compile/match5.rs
gcc/testsuite/rust/compile/pattern-struct.rs [new file with mode: 0644]