https://gcc.gnu.org/g:eac87511ccb71cee83d8b5f2cff27e1f36ee1715
commit r16-6198-geac87511ccb71cee83d8b5f2cff27e1f36ee1715 Author: Pierre-Emmanuel Patry <[email protected]> Date: Wed Dec 3 14:05:10 2025 +0100 gccrs: Move function to utils namespace 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]> Diff: --- 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 88f77d4ef183..b7cd57395560 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 87aab15c5c6f..9d937206e698 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
