]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: Fix ICE with empty generic arguments
authorPhilip Herron <herron.philip@googlemail.com>
Thu, 17 Apr 2025 14:53:58 +0000 (15:53 +0100)
committerPhilip Herron <philip.herron@embecosm.com>
Fri, 18 Apr 2025 16:06:33 +0000 (16:06 +0000)
commit4d70c16011e809a6732a0c34f1fc23ca75851476
tree36ca5a6191a9041da1acc9dcf7a3418337f465ae
parent47d55fe8cb022d11b7899f8e93761a61ee38c583
gccrs: Fix ICE with empty generic arguments

We have an assertion when accessing generic args if there are any which
is really useful so this adds the missing guards for the case where
they are specified but empty.

Fixes Rust-GCC#3649

gcc/rust/ChangeLog:

* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): add guard
* expand/rust-expand-visitor.cc (ExpandVisitor::visit): add guard

gcc/testsuite/ChangeLog:

* rust/compile/nr2/exclude: nr2 is missing error for this
* rust/compile/issue-3649.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/ast/rust-ast-visitor.cc
gcc/rust/expand/rust-expand-visitor.cc
gcc/testsuite/rust/compile/issue-3649.rs [new file with mode: 0644]
gcc/testsuite/rust/compile/nr2/exclude