https://gcc.gnu.org/g:daa810b588d39e0a750bfe59f53b0c35c37cd639
commit r17-5934-gdaa810b588d39e0a750bfe59f53b0c35c37cd639 Author: Wesley Lewis <[email protected]> Date: Mon Oct 19 02:27:58 2026 +0530 gccrs: error when parsing only $ Fixes Rust-GCC/gccrs#4937 gcc/rust/ChangeLog: * parse/rust-parse-impl-macro.hxx (Parser<ManagedTokenSource>::parse_macro_invocation_semi): Added error. gcc/testsuite/ChangeLog: * rust/compile/just_dollar.rs: New test. Signed-off-by: Wesley Lewis <[email protected]> Diff: --- gcc/rust/parse/rust-parse-impl-macro.hxx | 6 +++++- gcc/testsuite/rust/compile/just_dollar.rs | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/rust/parse/rust-parse-impl-macro.hxx b/gcc/rust/parse/rust-parse-impl-macro.hxx index 9f168bfdcfcf..4f3c3b7de56e 100644 --- a/gcc/rust/parse/rust-parse-impl-macro.hxx +++ b/gcc/rust/parse/rust-parse-impl-macro.hxx @@ -33,7 +33,11 @@ Parser<ManagedTokenSource>::parse_macro_invocation_semi ( location_t macro_locus = lexer.peek_token ()->get_locus (); auto path = parse_simple_path (); if (!path) - return nullptr; + { + rust_error_at (lexer.peek_token ()->get_locus (), + "failed to parse macro invocation path"); + return nullptr; + } if (!skip_token (EXCLAM)) { diff --git a/gcc/testsuite/rust/compile/just_dollar.rs b/gcc/testsuite/rust/compile/just_dollar.rs new file mode 100644 index 000000000000..424fb511f6f3 --- /dev/null +++ b/gcc/testsuite/rust/compile/just_dollar.rs @@ -0,0 +1 @@ +$ // { dg-error "failed to parse macro invocation path" "" { target *-*-* } } \ No newline at end of file
