]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Change debug log call to as_string function
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Mon, 9 Oct 2023 11:06:22 +0000 (13:06 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 18:09:11 +0000 (19:09 +0100)
This will ensure an accurate representation of the token. Also update the
as_string function to represent accurately scope resolution tokens.

gcc/rust/ChangeLog:

* lex/rust-token.cc (Token::as_string): Update function to output scope
resolution tokens correctly.
* parse/rust-parse-impl.h (Parser::parse_generic_param): Change call to
as_string.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/lex/rust-token.cc
gcc/rust/parse/rust-parse-impl.h

index 868946f65f3ca13373d75829accef331b4cfd146..ea355051bba3f2094d8362ca768ac94b33a5d54f 100644 (file)
@@ -245,6 +245,8 @@ Token::as_string () const
          return "b'" + escape_special_chars (get_str (), Context::Char) + "'";
        case LIFETIME:
          return "'" + get_str ();
+       case SCOPE_RESOLUTION:
+         return "::";
        case INT_LITERAL:
          if (get_type_hint () == CORETYPE_UNKNOWN)
            return get_str ();
index 214a7eefda068268648a3bc5e5d66d29e4cffdb9..7f4708543cb6f88f85d71c73f8d8bff5e717fd93 100644 (file)
@@ -3093,7 +3093,7 @@ Parser<ManagedTokenSource>::parse_generic_param (EndTokenPred is_end_token)
       // FIXME: Can we clean this last call with a method call?
       rust_error_at (token->get_locus (),
                     "unexpected token when parsing generic parameters: %qs",
-                    token->get_str ().c_str ());
+                    token->as_string ().c_str ());
       return nullptr;
     }