aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-10-10 13:11:55 +0200
committerP-E-P <32375388+P-E-P@users.noreply.github.com>2023-10-17 13:19:47 +0000
commit66aa1799f5873ae57149849fbcca372eaa0a7643 (patch)
tree013190796da9d7cdb81e7c2b060806c4aec0a652
parent6658219e9b66f918d24befbea7d80de486817fb3 (diff)
downloadgcc-66aa1799f5873ae57149849fbcca372eaa0a7643.zip
gcc-66aa1799f5873ae57149849fbcca372eaa0a7643.tar.gz
gcc-66aa1799f5873ae57149849fbcca372eaa0a7643.tar.bz2
Fix RangeFromExpr parsing in for loops
Those ranges were looking for a curly brace after the brace, leading to an error when using range from expr in for loops. gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_expr): Fix range from expr. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
-rw-r--r--gcc/rust/parse/rust-parse-impl.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index 230ee38..83f8ed3 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -22,6 +22,7 @@
/* DO NOT INCLUDE ANYWHERE - this is automatically included with rust-parse.h
* This is also the reason why there are no include guards. */
+#include "rust-token.h"
#define INCLUDE_ALGORITHM
#include "rust-diagnostics.h"
#include "rust-make-unique.h"
@@ -12089,7 +12090,7 @@ Parser<ManagedTokenSource>::parse_expr (int right_binding_power,
{
TokenId id = current_token->get_id ();
if (id == SEMICOLON || id == RIGHT_PAREN || id == RIGHT_CURLY
- || id == RIGHT_SQUARE || id == COMMA)
+ || id == RIGHT_SQUARE || id == COMMA || id == LEFT_CURLY)
return nullptr;
}