diff options
author | Lyra <teromene@teromene.fr> | 2021-05-05 19:00:33 +0200 |
---|---|---|
committer | Lyra <teromene@teromene.fr> | 2021-05-05 19:00:33 +0200 |
commit | e355d22a21afc2dbfc339f20a4c6ae3cb4e41c93 (patch) | |
tree | 46cca356ac8931d2be00a4f35bbe10998c382e95 | |
parent | 082161121ca7fbf8fdafb0edcd86f2126df9f832 (diff) | |
download | gcc-e355d22a21afc2dbfc339f20a4c6ae3cb4e41c93.zip gcc-e355d22a21afc2dbfc339f20a4c6ae3cb4e41c93.tar.gz gcc-e355d22a21afc2dbfc339f20a4c6ae3cb4e41c93.tar.bz2 |
Throw error instead of crashing when a whitespace is encountered within an assignment operation
-rw-r--r-- | gcc/rust/parse/rust-parse-impl.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index 6d38ace..06f8ef7 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -11456,6 +11456,9 @@ Parser<ManagedTokenSource>::parse_stmt_or_expr_with_block ( std::vector<AST::Attribute> outer_attrs) { auto expr = parse_expr_with_block (std::move (outer_attrs)); + if (expr == nullptr) + return ExprOrStmt::create_error(); + auto tok = lexer.peek_token (); // tail expr in a block expr |