diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-08-29 16:23:51 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-08-30 11:07:25 +0200 |
commit | 8dfa9676db0f8660c6c745adb59ef6323dca2341 (patch) | |
tree | 4e3cf661364bf76691e96e9c641d4cc4864897d3 /gcc | |
parent | 64c7a90934f03630356c76d7aa9ba6978ee4e9e6 (diff) | |
download | gcc-8dfa9676db0f8660c6c745adb59ef6323dca2341.zip gcc-8dfa9676db0f8660c6c745adb59ef6323dca2341.tar.gz gcc-8dfa9676db0f8660c6c745adb59ef6323dca2341.tar.bz2 |
transcriber: Do not infinite loop if the current parsed node is an error
Co-authored-by: philberty <philip.herron@embecosm.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/expand/rust-macro-expand.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/rust/expand/rust-macro-expand.cc b/gcc/rust/expand/rust-macro-expand.cc index 1d57e39..d654b2c 100644 --- a/gcc/rust/expand/rust-macro-expand.cc +++ b/gcc/rust/expand/rust-macro-expand.cc @@ -727,6 +727,14 @@ parse_many (Parser<MacroInvocLexer> &parser, TokenId &delimiter, break; auto node = parse_fn (); + if (node.is_error ()) + { + for (auto err : parser.get_errors ()) + err.emit_error (); + + return AST::ASTFragment::create_error (); + } + nodes.emplace_back (std::move (node)); } |