]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Move function to utils namespace
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Wed, 3 Dec 2025 13:05:10 +0000 (14:05 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Wed, 17 Dec 2025 06:20:12 +0000 (07:20 +0100)
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 <pierre-emmanuel.patry@embecosm.com>
gcc/rust/parse/rust-parse-impl.h
gcc/rust/parse/rust-parse-utils.h

index 88f77d4ef183e8e233c420a3dcf23c30352ee299..b7cd57395560a618f76b89def46d5e1205b37522 100644 (file)
@@ -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:
index 87aab15c5c6f3f32d775afd8515059c07546e31e..9d937206e6988e723b0b5e9f1fdc1a81c852bc0c 100644 (file)
@@ -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