]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: fix ICE with bad match arm type
authorPhilip Herron <herron.philip@googlemail.com>
Wed, 29 Mar 2023 14:57:56 +0000 (15:57 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:28:40 +0000 (18:28 +0100)
commit5973c1a788631addcb141fca4f43e75ab8846bf2
tree5bdbe84ab4249aa73a6595ac8d8ff3fd13a7e58d
parentf7379085ae54bd553d84353ca8ed4ccc2d233f17
gccrs: fix ICE with bad match arm type

We expect to get some kind of ADT or Tuple type when computing this kind of
match arms this adds a new diagnostic to check for this case instead of
an assertion.

Fixes #2029

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): return early on bad type
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::TypeCheckPattern):
remove assertion in favor of check
(TypeCheckPattern::visit): likewise

gcc/testsuite/ChangeLog:

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

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