]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: fix ICE segfault with empty feature gate
authorMatty Kuhn <matty.kuhn.1@gmail.com>
Sat, 5 Apr 2025 00:09:41 +0000 (18:09 -0600)
committerP-E-P <32375388+P-E-P@users.noreply.github.com>
Mon, 7 Apr 2025 08:27:17 +0000 (08:27 +0000)
commit3f2e8aef6f9e70da075261da80fa1400a2341634
tree281addc4318a1d4b26b6be78e22779f1a271bbd2
parent1d07cf75d5c558728d95a668a06dd7ecb4f5bb47
gccrs: fix ICE segfault with empty feature gate

This patch fixes an issue where an empty feature gate would segfault,
instead of reporting a syntax error to the user.

gcc/rust/ChangeLog:

* ast/rust-ast.h: (AST::Attribute): add empty_input function
* checks/errors/rust-feature-gate.cc: (FeatureGate::visit): check for empty feature gate

gcc/testsuite/ChangeLog:

* rust/compile/feature.rs: add an invalid empty feature to produce an error

Signed-off-by: Matty Kuhn <matty.kuhn.1@gmail.com>
gcc/rust/ast/rust-ast.h
gcc/rust/checks/errors/rust-feature-gate.cc
gcc/testsuite/rust/compile/feature.rs