]> 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)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 8 Apr 2025 08:17:20 +0000 (10:17 +0200)
commita75a697ff0a5bafd23c468940943b80082088dba
tree32426793754657450a48695ac93b20083f3d33d6
parent8885e9e109b664977479b23d8b976fdfaa576665
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