From: Pierre-Emmanuel Patry <[email protected]>

gcc/rust/ChangeLog:

        * parse/rust-parse-impl.h (can_tok_start_type): Move function from ...
        * parse/rust-parse-utils.h (can_tok_start_type): ... to here.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
---
This change was merged into the gccrs repository and is posted here for
upstream visibility and potential drive-by review, as requested by GCC
release managers.
Each commit email contains a link to its details on github from where you can
find the Pull-Request and associated discussions.


Commit on github: 
https://github.com/Rust-GCC/gccrs/commit/071eaf33db107782f108b15c5c7e2a92264125d2

The commit has been mentioned in the following pull-request(s):
 - https://github.com/Rust-GCC/gccrs/pull/4322

 gcc/rust/parse/rust-parse-impl.h  | 39 +------------------------------
 gcc/rust/parse/rust-parse-utils.h | 37 +++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index 88f77d4ef..b7cd57395 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -142,43 +142,6 @@ enum binding_powers
   LBP_LOWEST = 0
 };
 
-/* Returns whether the token can start a type (i.e. there is a valid type
- * beginning with the token). */
-inline bool
-can_tok_start_type (TokenId id)
-{
-  switch (id)
-    {
-    case EXCLAM:
-    case LEFT_SQUARE:
-    case LEFT_ANGLE:
-    case UNDERSCORE:
-    case ASTERISK:
-    case AMP:
-    case LIFETIME:
-    case IDENTIFIER:
-    case SUPER:
-    case SELF:
-    case SELF_ALIAS:
-    case CRATE:
-    case DOLLAR_SIGN:
-    case SCOPE_RESOLUTION:
-    case LEFT_PAREN:
-    case FOR:
-    case ASYNC:
-    case CONST:
-    case UNSAFE:
-    case EXTERN_KW:
-    case FN_KW:
-    case IMPL:
-    case DYN:
-    case QUESTION_MARK:
-      return true;
-    default:
-      return false;
-    }
-}
-
 /* HACK-y special handling for skipping a right angle token at the end of
  * generic arguments.
  * Currently, this replaces the "current token" with one that is identical
@@ -12319,7 +12282,7 @@ Parser<ManagedTokenSource>::null_denotation_path (
                           && (lexer.peek_token (2)->get_id () == COMMA
                               || (lexer.peek_token (2)->get_id () == COLON
                                   && (lexer.peek_token (4)->get_id () == COMMA
-                                      || !can_tok_start_type (
+                                      || !Parse::Utils::can_tok_start_type (
                                         lexer.peek_token (3)->get_id ()))));
 
        /* definitely not a block:
diff --git a/gcc/rust/parse/rust-parse-utils.h 
b/gcc/rust/parse/rust-parse-utils.h
index 87aab15c5..9d937206e 100644
--- a/gcc/rust/parse/rust-parse-utils.h
+++ b/gcc/rust/parse/rust-parse-utils.h
@@ -82,6 +82,43 @@ is_right_angle_tok (TokenId id)
     }
 }
 
+/* Returns whether the token can start a type (i.e. there is a valid type
+ * beginning with the token). */
+inline bool
+can_tok_start_type (TokenId id)
+{
+  switch (id)
+    {
+    case EXCLAM:
+    case LEFT_SQUARE:
+    case LEFT_ANGLE:
+    case UNDERSCORE:
+    case ASTERISK:
+    case AMP:
+    case LIFETIME:
+    case IDENTIFIER:
+    case SUPER:
+    case SELF:
+    case SELF_ALIAS:
+    case CRATE:
+    case DOLLAR_SIGN:
+    case SCOPE_RESOLUTION:
+    case LEFT_PAREN:
+    case FOR:
+    case ASYNC:
+    case CONST:
+    case UNSAFE:
+    case EXTERN_KW:
+    case FN_KW:
+    case IMPL:
+    case DYN:
+    case QUESTION_MARK:
+      return true;
+    default:
+      return false;
+    }
+}
+
 } // namespace Utils
 
 } // namespace Parse
-- 
2.52.0

Reply via email to