Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2194981/?format=api
{ "id": 2194981, "url": "http://patchwork.ozlabs.org/api/patches/2194981/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260210105524.2955-1-gerris.rs@gmail.com/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/projects/17/?format=api", "name": "GNU Compiler Collection", "link_name": "gcc", "list_id": "gcc-patches.gcc.gnu.org", "list_email": "gcc-patches@gcc.gnu.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260210105524.2955-1-gerris.rs@gmail.com>", "list_archive_url": null, "date": "2026-02-10T10:55:24", "name": "[gccrs,COMMIT] Remove ProcMacroInvocLexer", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "3bb267ef387513f98c5b19dc4d5613da99557754", "submitter": { "id": 92092, "url": "http://patchwork.ozlabs.org/api/people/92092/?format=api", "name": null, "email": "gerris.rs@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260210105524.2955-1-gerris.rs@gmail.com/mbox/", "series": [ { "id": 491650, "url": "http://patchwork.ozlabs.org/api/series/491650/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=491650", "date": "2026-02-10T10:55:24", "name": "[gccrs,COMMIT] Remove ProcMacroInvocLexer", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/491650/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2194981/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2194981/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20230601 header.b=Jm5I8Cfe;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)", "sourceware.org;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20230601 header.b=Jm5I8Cfe", "sourceware.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com", "sourceware.org; spf=pass smtp.mailfrom=gmail.com", "server2.sourceware.org;\n arc=none smtp.remote-ip=74.125.82.176" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4f9JQ94ys4z1xtV\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 10 Feb 2026 21:56:01 +1100 (AEDT)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 4BC534CF307A\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 10 Feb 2026 10:55:59 +0000 (GMT)", "from mail-dy1-f176.google.com (mail-dy1-f176.google.com\n [74.125.82.176])\n by sourceware.org (Postfix) with ESMTPS id 3B64E4CD2029\n for <gcc-patches@gcc.gnu.org>; Tue, 10 Feb 2026 10:55:28 +0000 (GMT)", "by mail-dy1-f176.google.com with SMTP id\n 5a478bee46e88-2ba68df3687so3596269eec.1\n for <gcc-patches@gcc.gnu.org>; Tue, 10 Feb 2026 02:55:28 -0800 (PST)", "from\n runnervmwffz4.r2y4yq0y4ogehklkrvsptntmwc.yx.internal.cloudapp.net\n ([57.151.138.5]) by smtp.gmail.com with ESMTPSA id\n 5a478bee46e88-2b855b1a6d3sm9427562eec.15.2026.02.10.02.55.25\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 10 Feb 2026 02:55:26 -0800 (PST)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 4BC534CF307A", "OpenDKIM Filter v2.11.0 sourceware.org 3B64E4CD2029" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 3B64E4CD2029", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 3B64E4CD2029", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1770720928; cv=none;\n b=LK3sMeSvS//Ba8GNpdagHgpJjufsaVv4emHq5vm8qx+z79umHJztERbW8bE3HksK+yZQ3tyG61BHIxBd3jRvhdQqADTqN5ATo4HuA/rB2wE3sEN2xV3DaioK7CtBSyw/6movbxnwXnZRTeClnEHf9+iAZJWH0mHCwZ9NcyDonGA=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1770720928; c=relaxed/simple;\n bh=UH4HfpxNrM3cTfXT0Egn/9eew2wWI8DutWWJsleV9C4=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=swRRYYy7QXNomJtykW+7oBWHLLydkxJ3xDGn154plk5eBGDagTRpUOI3ZRZfg6OEPIHJwJjmoY2pCO5dsR9EISiWI4/fXSVsiqZIOkAF2ZEfejfzYg7zX6At0/GfPK3iFfDdC9L2HC8jd4x4Gle3L/Ed9vsmuPi9woYs6Rvg9eE=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20230601; t=1770720927; x=1771325727; darn=gcc.gnu.org;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=hEtE+9TkAdKUr61gn9AErVIi8kUZhH7neAekaDX9heE=;\n b=Jm5I8CfeqErhPfe3KDV9KoDXS6ajUOAqO6vr1EXMOsX0jJGjlcoda88cU81d2lRBox\n Gwcf1KIPcP9irUIvk/UAh08Gw35VMHa1hBvardjS5pQLM1Z+StQkiXw2ZLOV+K0NPmoj\n 7R1dmxT3shcX3jZC1XylL5w4MOy/Q1So4T3qlAt1suT2M+CXNarpd0XRerGRWkf7I18b\n CGaku9JwbPg/5ueg3Bay5seLXlSr8dVkdMxCNpSvg+812nFko+u1V0yYA9qjkjM+/Rse\n diZbDhKo0xcyyonv+vcl57ZDhvVrvNhxe8lvMeUeGQDB3dxRN3lBI0mTWBUUtTUwgFxv\n 1TWQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1770720927; x=1771325727;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=hEtE+9TkAdKUr61gn9AErVIi8kUZhH7neAekaDX9heE=;\n b=DuGsKCkbJIx9oqlBO+ZX/9jN4ULF2Zcs3hOE+Px5/4x0UIWBhouhdrCmlRabrExA5k\n cThGKAOSk3dkeYoEHYRi1pViAtHlz3kAWdx/ishvBFTHENM0fTmuDVl2MDTkmUJHmiYM\n BCnFDbKLJKhAT7lEg155wxAyajPHQraMECGMmyzGnxTeD5EspMBe3OfjlcVQ0AKHrSo5\n mh7vkChxpuj85oEHmEe0WBL8gaOzW2AKnOVNEOG5eGLQWBnioukeG06ElnXsz4I4U9XW\n hCrH92/PHGEMzME9pd3xBn613AZrJ/H9H++NMjgNsGJN0XxFnLbMCjRSDMwcq6pS8Jt7\n z1Eg==", "X-Gm-Message-State": "AOJu0YwNdh8zxJt0czMAwLZea4z5lUzH51MiGrnqt4c/dHHTkbvDrKB9\n pQgo0urNTMndezi1LjNTULt+wgxV6CaO8ohOuiQHlcezn+ui0gbiFgTbeAEHTQ==", "X-Gm-Gg": "AZuq6aLu9JArACBVQzTdiyqBkW2hHWVbRZhv72XVzzHK/NqzbHbp4QhHPC91S4bctzW\n 4FvsZEv7nCjIWf+qtpjespUcFR0d5BgYkRtZkVvJ+Qy9fVQauNVmVbl00BvorpMErtgE3ALv9gf\n aUbFt8reGyrbrdv/5WZ2YjC6fkJtyLZKosX3qbGmbB2YlIWhWeg3Be49rBllarP+3tR1US+2E8L\n Zw9y14WHeoW29eXaBNa5vMblpaNGSabKBNI833HTmfZEh4QWodmV+ZKlc9It/MTxp9HfyZqXPZ0\n jpCBgJdKlp+Bh51sdRx2s16WmnuYe5xOqK5sx+Qqpa9l5XSnUxPfPd+K7ucgCNZOjOVO8BRuQQ6\n Y0dkeBcO+zv2mCQxEgacdtL2DrRWgHlkU9PRKmedx+LuzoUL5ku5NgTpxGhe0FEW6Z0hXdGsKac\n oGPeNcV5zOSneXoU2WgETrgCLZbaJBwMNQJ7WtYU1T0OGNEzfkAd4s8SJo8iCJltVP0pb0u3mmv\n AQjiGZ/Osyq7QzQzS8=", "X-Received": "by 2002:a05:7300:e616:b0:2ba:8cc1:7456 with SMTP id\n 5a478bee46e88-2ba8cc177d2mr648659eec.19.1770720926942;\n Tue, 10 Feb 2026 02:55:26 -0800 (PST)", "From": "gerris.rs@gmail.com", "To": "gcc-patches@gcc.gnu.org,\n\tgcc-rust@gcc.gnu.org", "Cc": "pierre-emmanuel.patry@embecosm.com, arthur.cohen@embecosm.com,\n dkm+gccrs@kataplop.net, Owen Avery <powerboat9.gamer@gmail.com>", "Subject": "[gccrs COMMIT] Remove ProcMacroInvocLexer", "Date": "Tue, 10 Feb 2026 10:55:24 +0000", "Message-ID": "<20260210105524.2955-1-gerris.rs@gmail.com>", "X-Mailer": "git-send-email 2.43.0", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "gcc-patches@gcc.gnu.org", "X-Mailman-Version": "2.1.30", "Precedence": "list", "List-Id": "Gcc-patches mailing list <gcc-patches.gcc.gnu.org>", "List-Unsubscribe": "<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>", "List-Archive": "<https://gcc.gnu.org/pipermail/gcc-patches/>", "List-Post": "<mailto:gcc-patches@gcc.gnu.org>", "List-Help": "<mailto:gcc-patches-request@gcc.gnu.org?subject=help>", "List-Subscribe": "<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>", "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org" }, "content": "From: Owen Avery <powerboat9.gamer@gmail.com>\n\nProcMacroInvocLexer and MacroInvocLexer were only separate because one\nstored instances of const_TokenPtr directly, while the other stored\ninstances of AST::Token (a thin wrapper around const_TokenPtr). This\npatch removes ProcMacroInvocLexer and makes MacroInvocLexer directly\nstore const_TokenPtr instances.\n\ngcc/rust/ChangeLog:\n\n\t* Make-lang.in (GRS_OBJS): Remove entries.\n\t* ast/rust-ast.cc (DelimTokenTree::parse_to_meta_item): Handle\n\tchanges to AttributeParser.\n\t(AttributeParser::AttributeParser): Change signature.\n\t* ast/rust-macro.h (AttributeParser::AttributeParser): Likewise.\n\t* expand/rust-macro-expand.cc\n\t(MacroExpander::expand_eager_invocations): Handle changes to\n\tMacroInvocLexer.\n\t(MacroExpander::parse_proc_macro_output): Use MacroInvocLexer\n\tinstead of ProcMacroInvocLexer.\n\t* expand/rust-macro-expand.h: Remove inclusion of\n\t\"rust-proc-macro-invoc-lexer.h\".\n\t* expand/rust-macro-invoc-lexer.cc\n\t(MacroInvocLexer::peek_token): Handle changes to MacroInvocLexer\n\tinternal representation.\n\t(MacroInvocLexer::get_token_slice): Likewise.\n\t(MacroInvocLexer::split_current_token): Likewise and fix\n\titerator handling.\n\t* expand/rust-macro-invoc-lexer.h (class MacroInvocLexerBase):\n\tRemove and combine with...\n\t(class MacroInvocLexer): ...its now only derived class.\n\t* expand/rust-proc-macro-invoc-lexer.cc: Removed.\n\t* expand/rust-proc-macro-invoc-lexer.h: Removed.\n\t* parse/rust-parse-impl-proc-macro.cc: Removed.\n\nSigned-off-by: Owen Avery <powerboat9.gamer@gmail.com>\n---\nThis change was merged into the gccrs repository and is posted here for\nupstream visibility and potential drive-by review, as requested by GCC\nrelease managers.\nEach commit email contains a link to its details on github from where you can\nfind the Pull-Request and associated discussions.\n\n\nCommit on github: https://github.com/Rust-GCC/gccrs/commit/252649e2acc7b6ac2dc997ed7951f387fb6c5eef\n\nThe commit has been mentioned in the following pull-request(s):\n - https://github.com/Rust-GCC/gccrs/pull/4430\n\n gcc/rust/Make-lang.in | 2 -\n gcc/rust/ast/rust-ast.cc | 11 +++-\n gcc/rust/ast/rust-macro.h | 2 +-\n gcc/rust/expand/rust-macro-expand.cc | 8 +--\n gcc/rust/expand/rust-macro-expand.h | 1 -\n gcc/rust/expand/rust-macro-invoc-lexer.cc | 21 +++---\n gcc/rust/expand/rust-macro-invoc-lexer.h | 48 +++++++-------\n .../expand/rust-proc-macro-invoc-lexer.cc | 65 -------------------\n gcc/rust/expand/rust-proc-macro-invoc-lexer.h | 48 --------------\n gcc/rust/parse/rust-parse-impl-proc-macro.cc | 34 ----------\n 10 files changed, 48 insertions(+), 192 deletions(-)\n delete mode 100644 gcc/rust/expand/rust-proc-macro-invoc-lexer.cc\n delete mode 100644 gcc/rust/expand/rust-proc-macro-invoc-lexer.h\n delete mode 100644 gcc/rust/parse/rust-parse-impl-proc-macro.cc\n\n\nbase-commit: c4bc3153bffc32eced40a54a83fe8863729456c8", "diff": "diff --git a/gcc/rust/Make-lang.in b/gcc/rust/Make-lang.in\nindex c0b2ef7e6..5c8f0d902 100644\n--- a/gcc/rust/Make-lang.in\n+++ b/gcc/rust/Make-lang.in\n@@ -73,7 +73,6 @@ GRS_OBJS = \\\n rust/rust-lex.o \\\n rust/rust-cfg-parser.o \\\n rust/rust-parse.o \\\n- rust/rust-parse-impl-proc-macro.o \\\n rust/rust-parse-impl-macro.o \\\n rust/rust-parse-impl-lexer.o \\\n rust/rust-ast.o \\\n@@ -109,7 +108,6 @@ GRS_OBJS = \\\n rust/rust-derive-hash.o \\\n rust/rust-proc-macro.o \\\n rust/rust-macro-invoc-lexer.o \\\n- rust/rust-proc-macro-invoc-lexer.o \\\n rust/rust-macro-substitute-ctx.o \\\n rust/rust-macro-builtins.o \\\n rust/rust-macro-builtins-helpers.o \\\ndiff --git a/gcc/rust/ast/rust-ast.cc b/gcc/rust/ast/rust-ast.cc\nindex 9813e7795..30fb5f4d5 100644\n--- a/gcc/rust/ast/rust-ast.cc\n+++ b/gcc/rust/ast/rust-ast.cc\n@@ -3554,7 +3554,12 @@ DelimTokenTree::parse_to_meta_item () const\n \n /* assume top-level delim token tree in attribute - convert all nested ones\n * to token stream */\n- std::vector<std::unique_ptr<Token>> token_stream = to_token_stream ();\n+ std::vector<std::unique_ptr<Token>> token_stream_wrapped = to_token_stream ();\n+\n+ std::vector<const_TokenPtr> token_stream;\n+ token_stream.reserve (token_stream_wrapped.size ());\n+ for (auto &tk : token_stream_wrapped)\n+ token_stream.push_back (tk->get_tok_ptr ());\n \n AttributeParser parser (std::move (token_stream));\n std::vector<std::unique_ptr<MetaItemInner>> meta_items (\n@@ -3563,8 +3568,8 @@ DelimTokenTree::parse_to_meta_item () const\n return new AttrInputMetaItemContainer (std::move (meta_items));\n }\n \n-AttributeParser::AttributeParser (\n- std::vector<std::unique_ptr<Token>> token_stream, int stream_start_pos)\n+AttributeParser::AttributeParser (std::vector<const_TokenPtr> token_stream,\n+\t\t\t\t int stream_start_pos)\n : lexer (new MacroInvocLexer (std::move (token_stream))),\n parser (new Parser<MacroInvocLexer> (*lexer))\n {\ndiff --git a/gcc/rust/ast/rust-macro.h b/gcc/rust/ast/rust-macro.h\nindex 2fe190e1d..ff6cca5af 100644\n--- a/gcc/rust/ast/rust-macro.h\n+++ b/gcc/rust/ast/rust-macro.h\n@@ -1134,7 +1134,7 @@ private:\n std::unique_ptr<Parser<MacroInvocLexer>> parser;\n \n public:\n- AttributeParser (std::vector<std::unique_ptr<Token>> token_stream,\n+ AttributeParser (std::vector<const_TokenPtr> token_stream,\n \t\t int stream_start_pos = 0);\n \n ~AttributeParser ();\ndiff --git a/gcc/rust/expand/rust-macro-expand.cc b/gcc/rust/expand/rust-macro-expand.cc\nindex aeea4c780..af29be7d7 100644\n--- a/gcc/rust/expand/rust-macro-expand.cc\n+++ b/gcc/rust/expand/rust-macro-expand.cc\n@@ -177,9 +177,9 @@ MacroExpander::expand_eager_invocations (AST::MacroInvocation &invoc)\n \n // we need to create a clone of the delimited token tree as the lexer\n // expects ownership of the tokens\n- std::vector<std::unique_ptr<Rust::AST::Token>> dtt_clone;\n+ std::vector<const_TokenPtr> dtt_clone;\n for (auto &tok : stream)\n- dtt_clone.emplace_back (tok->clone_token ());\n+ dtt_clone.emplace_back (tok->get_tok_ptr ());\n \n MacroInvocLexer lex (std::move (dtt_clone));\n Parser<MacroInvocLexer> parser (lex);\n@@ -1212,8 +1212,8 @@ MacroExpander::transcribe_rule (\n AST::Fragment\n MacroExpander::parse_proc_macro_output (ProcMacro::TokenStream ts)\n {\n- ProcMacroInvocLexer lex (convert (ts));\n- Parser<ProcMacroInvocLexer> parser (lex);\n+ MacroInvocLexer lex (convert (ts));\n+ Parser<MacroInvocLexer> parser (lex);\n \n std::vector<AST::SingleASTNode> nodes;\n switch (peek_context ())\ndiff --git a/gcc/rust/expand/rust-macro-expand.h b/gcc/rust/expand/rust-macro-expand.h\nindex cda4292cd..d843227be 100644\n--- a/gcc/rust/expand/rust-macro-expand.h\n+++ b/gcc/rust/expand/rust-macro-expand.h\n@@ -29,7 +29,6 @@\n #include \"rust-hir-map.h\"\n #include \"rust-name-resolver.h\"\n #include \"rust-macro-invoc-lexer.h\"\n-#include \"rust-proc-macro-invoc-lexer.h\"\n #include \"rust-token-converter.h\"\n #include \"rust-ast-collector.h\"\n #include \"rust-system.h\"\ndiff --git a/gcc/rust/expand/rust-macro-invoc-lexer.cc b/gcc/rust/expand/rust-macro-invoc-lexer.cc\nindex 306a0bee6..717f53dd7 100644\n--- a/gcc/rust/expand/rust-macro-invoc-lexer.cc\n+++ b/gcc/rust/expand/rust-macro-invoc-lexer.cc\n@@ -27,7 +27,7 @@ MacroInvocLexer::peek_token (int n)\n if ((offs + n) >= token_stream.size ())\n return Token::make (END_OF_FILE, UNDEF_LOCATION);\n \n- return token_stream.at (offs + n)->get_tok_ptr ();\n+ return token_stream.at (offs + n);\n }\n \n void\n@@ -39,14 +39,12 @@ MacroInvocLexer::split_current_token (TokenId new_left, TokenId new_right)\n auto l_tok = Token::make (new_left, current_token->get_locus ());\n auto r_tok = Token::make (new_right, current_token->get_locus ());\n \n- token_stream.erase (current_pos);\n+ current_pos = token_stream.erase (current_pos);\n \n // `insert` inserts before the specified position, so we insert the right one\n // then the left\n- token_stream.insert (current_pos,\n-\t\t std::unique_ptr<AST::Token> (new AST::Token (r_tok)));\n- token_stream.insert (current_pos,\n-\t\t std::unique_ptr<AST::Token> (new AST::Token (l_tok)));\n+ current_pos = token_stream.insert (current_pos, r_tok);\n+ token_stream.insert (current_pos, l_tok);\n }\n \n void\n@@ -56,12 +54,12 @@ MacroInvocLexer::split_current_token (std::vector<TokenPtr> new_tokens)\n \n auto current_pos = token_stream.begin () + offs;\n \n- token_stream.erase (current_pos);\n+ current_pos = token_stream.erase (current_pos);\n \n- for (size_t i = 1; i < new_tokens.size (); i++)\n+ for (auto &tk : new_tokens)\n {\n- token_stream.insert (current_pos + i, std::unique_ptr<AST::Token> (\n-\t\t\t\t\t new AST::Token (new_tokens[i])));\n+ current_pos = token_stream.insert (current_pos, std::move (tk));\n+ current_pos++;\n }\n }\n \n@@ -73,7 +71,8 @@ MacroInvocLexer::get_token_slice (size_t start_idx, size_t end_idx) const\n rust_assert (end_idx < token_stream.size ());\n \n for (size_t i = start_idx; i < end_idx; i++)\n- slice.emplace_back (token_stream[i]->clone_token ());\n+ slice.emplace_back (\n+ std::unique_ptr<AST::Token> (new AST::Token (token_stream[i])));\n \n return slice;\n }\ndiff --git a/gcc/rust/expand/rust-macro-invoc-lexer.h b/gcc/rust/expand/rust-macro-invoc-lexer.h\nindex 2d285df1d..6743159cf 100644\n--- a/gcc/rust/expand/rust-macro-invoc-lexer.h\n+++ b/gcc/rust/expand/rust-macro-invoc-lexer.h\n@@ -22,40 +22,28 @@\n #include \"rust-ast.h\"\n \n namespace Rust {\n-template <class T> class MacroInvocLexerBase\n+\n+class MacroInvocLexer\n {\n public:\n- MacroInvocLexerBase (std::vector<T> stream)\n+ MacroInvocLexer (std::vector<const_TokenPtr> stream)\n : offs (0), token_stream (std::move (stream))\n {}\n \n+ MacroInvocLexer (const std::vector<std::unique_ptr<AST::Token>> &stream)\n+ : offs (0)\n+ {\n+ token_stream.reserve (stream.size ());\n+ for (auto &tk : stream)\n+ token_stream.push_back (tk->get_tok_ptr ());\n+ }\n+\n // Advances current token to n + 1 tokens ahead of current position.\n void skip_token (int n) { offs += (n + 1); }\n \n // Skips the current token.\n void skip_token () { skip_token (0); }\n \n- std::string get_filename () const\n- {\n- // FIXME\n- rust_unreachable ();\n- return \"FIXME\";\n- }\n-\n- size_t get_offs () const { return offs; }\n-\n-protected:\n- size_t offs;\n- std::vector<T> token_stream;\n-};\n-\n-class MacroInvocLexer : public MacroInvocLexerBase<std::unique_ptr<AST::Token>>\n-{\n-public:\n- MacroInvocLexer (std::vector<std::unique_ptr<AST::Token>> stream)\n- : MacroInvocLexerBase (std::move (stream))\n- {}\n-\n // Returns token n tokens ahead of current position.\n const_TokenPtr peek_token (int n);\n \n@@ -71,7 +59,21 @@ public:\n \n std::vector<std::unique_ptr<AST::Token>>\n get_token_slice (size_t start_idx, size_t end_idx) const;\n+\n+ std::string get_filename () const\n+ {\n+ // FIXME\n+ rust_unreachable ();\n+ return \"FIXME\";\n+ }\n+\n+ size_t get_offs () const { return offs; }\n+\n+protected:\n+ size_t offs;\n+ std::vector<const_TokenPtr> token_stream;\n };\n+\n } // namespace Rust\n \n #endif // RUST_MACRO_INVOC_LEXER_H\ndiff --git a/gcc/rust/expand/rust-proc-macro-invoc-lexer.cc b/gcc/rust/expand/rust-proc-macro-invoc-lexer.cc\ndeleted file mode 100644\nindex 0949c717c..000000000\n--- a/gcc/rust/expand/rust-proc-macro-invoc-lexer.cc\n+++ /dev/null\n@@ -1,65 +0,0 @@\n-// Copyright (C) 2020-2026 Free Software Foundation, Inc.\n-\n-// This file is part of GCC.\n-\n-// GCC is free software; you can redistribute it and/or modify it under\n-// the terms of the GNU General Public License as published by the Free\n-// Software Foundation; either version 3, or (at your option) any later\n-// version.\n-\n-// GCC is distributed in the hope that it will be useful, but WITHOUT ANY\n-// WARRANTY; without even the implied warranty of MERCHANTABILITY or\n-// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n-// for more details.\n-\n-// You should have received a copy of the GNU General Public License\n-// along with GCC; see the file COPYING3. If not see\n-// <http://www.gnu.org/licenses/>.\n-\n-#include \"rust-proc-macro-invoc-lexer.h\"\n-#include \"rust-token.h\"\n-\n-namespace Rust {\n-\n-const_TokenPtr\n-ProcMacroInvocLexer::peek_token (int n)\n-{\n- if ((offs + n) >= token_stream.size ())\n- return Token::make (END_OF_FILE, UNDEF_LOCATION);\n-\n- return token_stream.at (offs + n);\n-}\n-\n-void\n-ProcMacroInvocLexer::split_current_token (TokenId new_left, TokenId new_right)\n-{\n- auto ¤t_token = token_stream.at (offs);\n- auto current_pos = token_stream.begin () + offs;\n-\n- auto l_tok = Token::make (new_left, current_token->get_locus ());\n- auto r_tok = Token::make (new_right, current_token->get_locus ());\n-\n- token_stream.erase (current_pos);\n-\n- // `insert` inserts before the specified position, so we insert the right one\n- // then the left\n- token_stream.insert (current_pos, l_tok);\n- token_stream.insert (current_pos, r_tok);\n-}\n-\n-void\n-ProcMacroInvocLexer::split_current_token (std::vector<TokenPtr> new_tokens)\n-{\n- rust_assert (new_tokens.size () > 0);\n-\n- auto current_pos = token_stream.begin () + offs;\n-\n- token_stream.erase (current_pos);\n-\n- for (size_t i = 1; i < new_tokens.size (); i++)\n- {\n- token_stream.insert (current_pos + i, new_tokens[i]);\n- }\n-}\n-\n-} // namespace Rust\ndiff --git a/gcc/rust/expand/rust-proc-macro-invoc-lexer.h b/gcc/rust/expand/rust-proc-macro-invoc-lexer.h\ndeleted file mode 100644\nindex 19542c125..000000000\n--- a/gcc/rust/expand/rust-proc-macro-invoc-lexer.h\n+++ /dev/null\n@@ -1,48 +0,0 @@\n-// Copyright (C) 2020-2026 Free Software Foundation, Inc.\n-\n-// This file is part of GCC.\n-\n-// GCC is free software; you can redistribute it and/or modify it under\n-// the terms of the GNU General Public License as published by the Free\n-// Software Foundation; either version 3, or (at your option) any later\n-// version.\n-\n-// GCC is distributed in the hope that it will be useful, but WITHOUT ANY\n-// WARRANTY; without even the implied warranty of MERCHANTABILITY or\n-// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n-// for more details.\n-\n-// You should have received a copy of the GNU General Public License\n-// along with GCC; see the file COPYING3. If not see\n-// <http://www.gnu.org/licenses/>.\n-\n-#ifndef RUST_PROC_MACRO_INVOC_LEXER_H\n-#define RUST_PROC_MACRO_INVOC_LEXER_H\n-\n-#include \"rust-lex.h\"\n-#include \"rust-macro-invoc-lexer.h\"\n-\n-namespace Rust {\n-class ProcMacroInvocLexer : public MacroInvocLexerBase<const_TokenPtr>\n-{\n-public:\n- ProcMacroInvocLexer (std::vector<const_TokenPtr> stream)\n- : MacroInvocLexerBase (std::move (stream))\n- {}\n-\n- // Returns token n tokens ahead of current position.\n- const_TokenPtr peek_token (int n);\n-\n- // Peeks the current token.\n- const_TokenPtr peek_token () { return peek_token (0); }\n-\n- // Splits the current token into two. Intended for use with nested generics\n- // closes (i.e. T<U<X>> where >> is wrongly lexed as one token). Note that\n- // this will only work with \"simple\" tokens like punctuation.\n- void split_current_token (TokenId new_left, TokenId new_right);\n-\n- void split_current_token (std::vector<TokenPtr> new_tokens);\n-};\n-} // namespace Rust\n-\n-#endif /* ! RUST_PROC_MACRO_INVOC_LEXER_H */\ndiff --git a/gcc/rust/parse/rust-parse-impl-proc-macro.cc b/gcc/rust/parse/rust-parse-impl-proc-macro.cc\ndeleted file mode 100644\nindex 342d3478b..000000000\n--- a/gcc/rust/parse/rust-parse-impl-proc-macro.cc\n+++ /dev/null\n@@ -1,34 +0,0 @@\n-// Copyright (C) 2025-2026 Free Software Foundation, Inc.\n-\n-// This file is part of GCC.\n-\n-// GCC is free software; you can redistribute it and/or modify it under\n-// the terms of the GNU General Public License as published by the Free\n-// Software Foundation; either version 3, or (at your option) any later\n-// version.\n-\n-// GCC is distributed in the hope that it will be useful, but WITHOUT ANY\n-// WARRANTY; without even the implied warranty of MERCHANTABILITY or\n-// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n-// for more details.\n-\n-// You should have received a copy of the GNU General Public License\n-// along with GCC; see the file COPYING3. If not see\n-// <http://www.gnu.org/licenses/>.\n-\n-#include \"rust-parse-impl.hxx\"\n-#include \"rust-proc-macro-invoc-lexer.h\"\n-\n-namespace Rust {\n-\n-template tl::expected<std::unique_ptr<AST::Item>, Parse::Error::Item>\n-Parser<ProcMacroInvocLexer>::parse_item (bool);\n-\n-template std::unique_ptr<AST::Stmt>\n- Parser<ProcMacroInvocLexer>::parse_stmt (ParseRestrictions);\n-\n-// instantiate entire class (or just more functions) if necessary\n-\n-// template class Parser<ProcMacroInvocLexer>;\n-\n-} // namespace Rust\n", "prefixes": [ "gccrs", "COMMIT" ] }