Fixes https://github.com/Rust-GCC/gccrs/issues/4054
gcc/rust/ChangeLog:
* parse/rust-parse-impl.h
(Parser::parse_identifier_or_keyword_token): Record error on
failure.
gcc/testsuite/ChangeLog:
* rust/compile/macros/mbe/macro-issue4054.rs: New test.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
}
else
{
+ add_error (Error (t->get_locus (), "expected keyword or identifier"));
return nullptr;
}
}
--- /dev/null
+#[allow(path_statements)]
+
+macro_rules! array_impl_default {
+ {$t:ident} => {
+ $t;
+ array_impl_default!{}
+ };
+ {} => {}
+}
+
+pub fn foo() {
+ let x = 12;
+ array_impl_default! {x}
+}