aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/expand/rust-macro-expand.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/rust/expand/rust-macro-expand.cc')
-rw-r--r--gcc/rust/expand/rust-macro-expand.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/rust/expand/rust-macro-expand.cc b/gcc/rust/expand/rust-macro-expand.cc
index 22ba1d8a..f131372 100644
--- a/gcc/rust/expand/rust-macro-expand.cc
+++ b/gcc/rust/expand/rust-macro-expand.cc
@@ -479,7 +479,7 @@ MacroExpander::match_fragment (Parser<MacroInvocLexer> &parser,
break;
case AST::MacroFragSpec::STMT:
- parser.parse_stmt ();
+ parser.parse_stmt (/* allow_no_semi */ true);
break;
case AST::MacroFragSpec::LIFETIME:
@@ -506,6 +506,9 @@ MacroExpander::match_fragment (Parser<MacroInvocLexer> &parser,
return false;
}
+ for (const auto &error : parser.get_errors ())
+ error.emit_error ();
+
// it matches if the parser did not produce errors trying to parse that type
// of item
return !parser.has_errors ();
@@ -825,7 +828,7 @@ transcribe_many_stmts (Parser<MacroInvocLexer> &parser, TokenId &delimiter)
// transcriber is an expression, but since the macro call is followed by
// a semicolon, it's a valid ExprStmt
return parse_many (parser, delimiter, [&parser] () {
- auto stmt = parser.parse_stmt ();
+ auto stmt = parser.parse_stmt (/* allow_no_semi */ true);
return AST::SingleASTNode (std::move (stmt));
});
}