get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2218000/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2218000,
    "url": "http://patchwork.ozlabs.org/api/patches/2218000/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260331084650.3092-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": "<20260331084650.3092-1-gerris.rs@gmail.com>",
    "list_archive_url": null,
    "date": "2026-03-31T08:46:50",
    "name": "[gccrs,COMMIT] Disambiguate identifier and path patterns",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "66e4aa7a4aea02e04779ae8138fc9f7a53ba05c6",
    "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/20260331084650.3092-1-gerris.rs@gmail.com/mbox/",
    "series": [
        {
            "id": 498147,
            "url": "http://patchwork.ozlabs.org/api/series/498147/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=498147",
            "date": "2026-03-31T08:46:50",
            "name": "[gccrs,COMMIT] Disambiguate identifier and path patterns",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/498147/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2218000/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2218000/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=20251104 header.b=BS+EphoH;\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=20251104 header.b=BS+EphoH",
            "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=209.85.160.169"
        ],
        "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 4flMFD4Q52z1y1q\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 31 Mar 2026 19:47:28 +1100 (AEDT)",
            "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 781D24BB591B\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 31 Mar 2026 08:47:26 +0000 (GMT)",
            "from mail-qt1-f169.google.com (mail-qt1-f169.google.com\n [209.85.160.169])\n by sourceware.org (Postfix) with ESMTPS id A56484BA2E3B\n for <gcc-patches@gcc.gnu.org>; Tue, 31 Mar 2026 08:46:55 +0000 (GMT)",
            "by mail-qt1-f169.google.com with SMTP id\n d75a77b69052e-50bbc41677dso36561561cf.0\n for <gcc-patches@gcc.gnu.org>; Tue, 31 Mar 2026 01:46:55 -0700 (PDT)",
            "from\n runnervmrg6be.fep4lis5yrsu3hkwtiiopce0wc.bx.internal.cloudapp.net\n ([172.190.93.135]) by smtp.gmail.com with ESMTPSA id\n d75a77b69052e-50bb7729698sm75447991cf.29.2026.03.31.01.46.51\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 31 Mar 2026 01:46:52 -0700 (PDT)"
        ],
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 sourceware.org 781D24BB591B",
            "OpenDKIM Filter v2.11.0 sourceware.org A56484BA2E3B"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org A56484BA2E3B",
        "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org A56484BA2E3B",
        "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1774946815; cv=none;\n b=f41QRWrx8GjydxsY9vDbEIT2hBLq3NWZIxjoHO/3eTQnAFzkturhRjvvsK5d1Gq0y496tc+JLassyeuoXcBXR90o8mCtcn4S0pB9/50CgQh4jvVl4mJr+mTlSs4Fpya6jb/KcweGVNhb9Rf7rNnleZqKC+vQXmJOjx7u2wLIYAc=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1774946815; c=relaxed/simple;\n bh=FDOA1i+vwknDV9JoDr2Jy6Mv7F72VLjydU2GOHeOyg8=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=ugWfm6tCirez8kx0znR+BoEXMOH31HcCPQ0yWT7nEhdWDyY+6lwUIQZxR58Bp4/yB7AiNnL7Gbklj9/GL5lDCFpY/gddwMGDs10OokCjlOiS1A1px4dc87PgaTEx7hjAbj10a2asWk8egQguDEfQ1K7dXPKbQmhTz3HIi/HPZ9s=",
        "ARC-Authentication-Results": "i=1; server2.sourceware.org",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1774946814; x=1775551614; 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=1tilCSeVWknEPEACEqoFnP6814V/+C0rgAa3hxuQquI=;\n b=BS+EphoHx5H1FLR40g0xohx12OL9u7wfU7gZfvQd/eDjoCZQmhFLoGwGt0iKZQGIHX\n XSi8s/Za/7jYTSKB/qb12JFmgEKPvldZB8FXZbXS96MOwkYyPCu/DD2Dwb7BbrgFO79r\n 8uaUajf6uDRPPuJTdPZH43Gd16Bbl1W/71PZKEJTIvH/Kh1ZCw4JIYtC9ZV4iaSjE7RK\n XoZHL18VvG4r6/z4IiahhwsetdupclHeWFk5Tc96HJ2idPunzQEUWEMmqE6imndAtTWZ\n w4GItgTuH0CNt2x2cPVHhSkugi0d2GhO1F80W/ehHxOsBlidJg7Fwg4p6DXfSeeMbR7L\n k/lg==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1774946814; x=1775551614;\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=1tilCSeVWknEPEACEqoFnP6814V/+C0rgAa3hxuQquI=;\n b=aChWIdtdKFMtYFG0NzMk1UlA24yr5AS4+ep6SeAZFf36Pta8DchJmz/GKcv1IkBGz0\n lpiQKM5tJPunBwNcjgks6hpllpmDurxX292eTYMTbiEu0N9k9WcgJxIXIUsFVugpebE6\n kLgOpc+AOsYmJZ8bh2RvPCmeJFO+Dmy+Q0SmUQK+RFCTtVWSWIXFuEoCVOMHdwzVdRYa\n wNInlTaC1uNKpb1scOak//h5idk4ms1QFzyzSWRdQ07+cEDclDFmHkViZO8LGSPxnR/y\n HzYehREq1qLzIBh7eBVfEBxqaUZiAEEKDnYf4xr41R+9S2/GZ9bVujmDLk+dzXM21ZrG\n rlbA==",
        "X-Gm-Message-State": "AOJu0YyqrilzE1xdnUILISTOj9/6BwxfIM9IzSeL0a9/IIyzLnZcFSVo\n TKY8kK2YeNsrkGnGDjENTyebwExNLNIvWdrSDvC3ESQagiTFW0wCLAmD+wVEaf/N",
        "X-Gm-Gg": "ATEYQzyuudbc5SQRKM/r1USEFN/S2qgS3NG/jbgW/47xpYg7f1q6Bod33CDOvZ47cMg\n mkYEXqtjaArQn+juseusgmpx5lHTGa+h/2Y/OymVmmHTS+Ohm7HXniPLrGHS7u2/Tmz72AeFDu/\n bo4PvNcwZsOCZfOjQnIvq4xDxu77RUVYLDEyfurHdjjwoTeWH48lD1gCSmBtqmuo5nRqY08rAFf\n 6BRzwmm/xhYCjxLZdY3XaBdYtxOECs77sS2nk8uTKSj8tDNRxwPMhqFhpAXSRKJEF6ZwQHFe2tv\n HR17VjwiD+iMe9zbdEUUZFxUpKiQRaTherQMK5nYpPt5qibB6YMa8dZEKytxqmxbGzKiEsvPJXB\n 4MMDVq0T2e+op+dEdEppyRjtYurbMApjacCDvtxvR/UR92PZbXmYtOF64ujaL46AQCR8AUhb+yg\n gbhz1Xby/ogfnw69nFHFz4UXUVj1eZGsmGtt8L0m2lB49vOOxZblQ7d44HJHly98IMkPl0ioOXS\n oWRrUJmTlvsthzpz95SY2g=",
        "X-Received": "by 2002:a05:622a:4c1b:b0:509:4b11:6cf4 with SMTP id\n d75a77b69052e-50ba3808032mr224248431cf.5.1774946813828;\n Tue, 31 Mar 2026 01:46:53 -0700 (PDT)",
        "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] Disambiguate identifier and path patterns",
        "Date": "Tue, 31 Mar 2026 08:46:50 +0000",
        "Message-ID": "<20260331084650.3092-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\ngcc/rust/ChangeLog:\n\n\t* Make-lang.in (GRS_OBJS): Add rust-identifier-path.o.\n\t* resolve/rust-early-name-resolver-2.0.cc: Include\n\t\"rust-identifier-path.h\".\n\t(Early::go): Use IdentifierPathPass.\n\t(Early::visit): Handle identifier patterns which should be path\n\tpatterns.\n\t* resolve/rust-early-name-resolver-2.0.h: Include\n\t\"rust-pattern.h\".\n\t(Early::visit): Add visiting function declaration for\n\tIdentifierPattern.\n\t(Early::ident_path_to_convert): New member variable.\n\t* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):\n\tCall Mappings::add_function_node.\n\t* util/rust-hir-map.cc (Mappings::add_function_node): New\n\tmember function definition.\n\t(Mappings::is_function_node): Likewise.\n\t* util/rust-hir-map.h (Mappings::add_function_node): New\n\tmember function declaration.\n\t(Mappings::is_function_node): Likewise.\n\t(Mappings::function_nodes): New member variable.\n\t* resolve/rust-identifier-path.cc: New file.\n\t* resolve/rust-identifier-path.h: New file.\n\ngcc/testsuite/ChangeLog:\n\n\t* rust/execute/ident_pat_vs_path_1.rs: New test.\n\t* rust/execute/ident_pat_vs_path_2.rs: New test.\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/de7dffce247c236349b418215c820ecb8965b090\n\nThe commit has been mentioned in the following pull-request(s):\n - https://github.com/Rust-GCC/gccrs/pull/4455\n\n gcc/rust/Make-lang.in                         |  1 +\n .../resolve/rust-early-name-resolver-2.0.cc   | 28 +++++++++\n .../resolve/rust-early-name-resolver-2.0.h    |  6 ++\n gcc/rust/resolve/rust-identifier-path.cc      | 61 +++++++++++++++++++\n gcc/rust/resolve/rust-identifier-path.h       | 50 +++++++++++++++\n .../rust-toplevel-name-resolver-2.0.cc        |  2 +\n gcc/rust/util/rust-hir-map.cc                 | 12 ++++\n gcc/rust/util/rust-hir-map.h                  |  5 ++\n .../rust/execute/ident_pat_vs_path_1.rs       | 27 ++++++++\n .../rust/execute/ident_pat_vs_path_2.rs       | 18 ++++++\n 10 files changed, 210 insertions(+)\n create mode 100644 gcc/rust/resolve/rust-identifier-path.cc\n create mode 100644 gcc/rust/resolve/rust-identifier-path.h\n create mode 100644 gcc/testsuite/rust/execute/ident_pat_vs_path_1.rs\n create mode 100644 gcc/testsuite/rust/execute/ident_pat_vs_path_2.rs\n\n\nbase-commit: bde2985a486cf5f5c000fc186f508471cdf20d12",
    "diff": "diff --git a/gcc/rust/Make-lang.in b/gcc/rust/Make-lang.in\nindex bd5646f7c..4c394d39c 100644\n--- a/gcc/rust/Make-lang.in\n+++ b/gcc/rust/Make-lang.in\n@@ -146,6 +146,7 @@ GRS_OBJS = \\\n \trust/rust-finalize-imports-2.0.o \\\n \trust/rust-ice-finalizer.o \\\n     rust/rust-late-name-resolver-2.0.o \\\n+    rust/rust-identifier-path.o \\\n \trust/rust-immutable-name-resolution-context.o \\\n     rust/rust-name-resolver.o \\\n     rust/rust-resolve-builtins.o \\\ndiff --git a/gcc/rust/resolve/rust-early-name-resolver-2.0.cc b/gcc/rust/resolve/rust-early-name-resolver-2.0.cc\nindex df29a55c8..91ad82c89 100644\n--- a/gcc/rust/resolve/rust-early-name-resolver-2.0.cc\n+++ b/gcc/rust/resolve/rust-early-name-resolver-2.0.cc\n@@ -27,6 +27,7 @@\n #include \"rust-attributes.h\"\n #include \"rust-finalize-imports-2.0.h\"\n #include \"rust-attribute-values.h\"\n+#include \"rust-identifier-path.h\"\n \n namespace Rust {\n namespace Resolver2_0 {\n@@ -70,6 +71,9 @@ Early::go (AST::Crate &crate)\n   visit (crate);\n \n   textual_scope.pop ();\n+\n+  // handle IdentifierPattern vs PathInExpression disambiguation\n+  IdentifierPathPass::go (crate, ctx, std::move (ident_path_to_convert));\n }\n \n bool\n@@ -543,5 +547,29 @@ Early::visit (AST::UseTreeList &use_list)\n   DefaultResolver::visit (use_list);\n }\n \n+void\n+Early::visit (AST::IdentifierPattern &identifier)\n+{\n+  // check if this is *really* a path pattern\n+  if (!identifier.get_is_ref () && !identifier.get_is_mut ()\n+      && !identifier.has_subpattern ())\n+    {\n+      auto res = ctx.values.get (identifier.get_ident ());\n+      if (res)\n+\t{\n+\t  if (res->is_ambiguous ())\n+\t    rust_error_at (identifier.get_locus (), ErrorCode::E0659,\n+\t\t\t   \"%qs is ambiguous\",\n+\t\t\t   identifier.get_ident ().as_string ().c_str ());\n+\t  else\n+\t    {\n+\t      // HACK: bail out if the definition is a function\n+\t      if (!ctx.mappings.is_function_node (res->get_node_id ()))\n+\t\tident_path_to_convert.insert (identifier.get_node_id ());\n+\t    }\n+\t}\n+    }\n+}\n+\n } // namespace Resolver2_0\n } // namespace Rust\ndiff --git a/gcc/rust/resolve/rust-early-name-resolver-2.0.h b/gcc/rust/resolve/rust-early-name-resolver-2.0.h\nindex bd9ccf66d..0fdf1436c 100644\n--- a/gcc/rust/resolve/rust-early-name-resolver-2.0.h\n+++ b/gcc/rust/resolve/rust-early-name-resolver-2.0.h\n@@ -26,6 +26,7 @@\n #include \"rust-default-resolver.h\"\n #include \"rust-rib.h\"\n #include \"rust-toplevel-name-resolver-2.0.h\"\n+#include \"rust-pattern.h\"\n \n namespace Rust {\n namespace Resolver2_0 {\n@@ -67,6 +68,8 @@ public:\n \n   void visit (AST::Attribute &) override;\n \n+  void visit (AST::IdentifierPattern &) override;\n+\n   struct ImportData\n   {\n     enum class Kind\n@@ -266,6 +269,9 @@ private:\n \t\t\t     const Early::ImportPair &mapping);\n \n   void finalize_rebind_import (const Early::ImportPair &mapping);\n+\n+  /* used to help conversion from IdentifierPattern to PathInExpression */\n+  std::set<NodeId> ident_path_to_convert;\n };\n \n } // namespace Resolver2_0\ndiff --git a/gcc/rust/resolve/rust-identifier-path.cc b/gcc/rust/resolve/rust-identifier-path.cc\nnew file mode 100644\nindex 000000000..30223a7b3\n--- /dev/null\n+++ b/gcc/rust/resolve/rust-identifier-path.cc\n@@ -0,0 +1,61 @@\n+// Copyright (C) 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-system.h\"\n+#include \"rust-identifier-path.h\"\n+#include \"rust-pattern.h\"\n+\n+namespace Rust {\n+namespace Resolver2_0 {\n+\n+IdentifierPathPass::IdentifierPathPass (NameResolutionContext &ctx,\n+\t\t\t\t\tstd::set<NodeId> ident_path_to_convert)\n+  : ctx (&ctx), ident_path_to_convert (std::move (ident_path_to_convert))\n+{}\n+\n+void\n+IdentifierPathPass::go (AST::Crate &crate, NameResolutionContext &ctx,\n+\t\t\tstd::set<NodeId> ident_path_to_convert)\n+{\n+  IdentifierPathPass pass (ctx, std::move (ident_path_to_convert));\n+  pass.visit (crate);\n+}\n+\n+void\n+IdentifierPathPass::reseat (std::unique_ptr<AST::Pattern> &ptr)\n+{\n+  AST::IdentifierPattern *ident_pat;\n+  if (ptr->get_pattern_kind () == AST::Pattern::Kind::Identifier)\n+    ident_pat = static_cast<AST::IdentifierPattern *> (ptr.get ());\n+  else\n+    return;\n+\n+  if (ident_path_to_convert.find (ident_pat->get_node_id ())\n+      != ident_path_to_convert.end ())\n+    {\n+      std::vector<AST::PathExprSegment> segments;\n+      segments.emplace_back (ident_pat->get_ident ().as_string (),\n+\t\t\t     ident_pat->get_locus ());\n+      ptr = std::make_unique<AST::PathInExpression> (\n+\tstd::move (segments), std::vector<AST::Attribute> (),\n+\tident_pat->get_locus ());\n+    }\n+}\n+\n+} // namespace Resolver2_0\n+} // namespace Rust\ndiff --git a/gcc/rust/resolve/rust-identifier-path.h b/gcc/rust/resolve/rust-identifier-path.h\nnew file mode 100644\nindex 000000000..5363a5e87\n--- /dev/null\n+++ b/gcc/rust/resolve/rust-identifier-path.h\n@@ -0,0 +1,50 @@\n+// Copyright (C) 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_RESOLVE_IDENTIFIER_PATH_H\n+#define RUST_RESOLVE_IDENTIFIER_PATH_H\n+\n+#include \"rust-ast-pointer-visitor.h\"\n+#include \"rust-name-resolution-context.h\"\n+\n+namespace Rust {\n+namespace Resolver2_0 {\n+\n+// changes IdentifierPattern instances to PathInExpression instances\n+class IdentifierPathPass : public AST::PointerVisitor\n+{\n+public:\n+  IdentifierPathPass (NameResolutionContext &ctx,\n+\t\t      std::set<NodeId> ident_path_to_convert);\n+\n+  static void go (AST::Crate &crate, NameResolutionContext &ctx,\n+\t\t  std::set<NodeId> ident_path_to_convert);\n+\n+  using AST::PointerVisitor::reseat;\n+\n+  void reseat (std::unique_ptr<AST::Pattern> &ptr) override;\n+\n+private:\n+  NameResolutionContext *ctx;\n+  std::set<NodeId> ident_path_to_convert;\n+};\n+\n+} // namespace Resolver2_0\n+} // namespace Rust\n+\n+#endif // ! RUST_RESOLVE_IDENTIFIER_PATH_H\ndiff --git a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc\nindex 2002df545..630b5ab8b 100644\n--- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc\n+++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc\n@@ -241,6 +241,8 @@ TopLevel::visit (AST::Function &function)\n   insert_or_error_out (function.get_function_name (), function,\n \t\t       Namespace::Values);\n \n+  Analysis::Mappings::get ().add_function_node (function.get_node_id ());\n+\n   DefaultResolver::visit (function);\n }\n \ndiff --git a/gcc/rust/util/rust-hir-map.cc b/gcc/rust/util/rust-hir-map.cc\nindex a58fef00d..89b956478 100644\n--- a/gcc/rust/util/rust-hir-map.cc\n+++ b/gcc/rust/util/rust-hir-map.cc\n@@ -1382,5 +1382,17 @@ Mappings::is_derived_node (NodeId node_id)\n   return derived_nodes.find (node_id) != derived_nodes.end ();\n }\n \n+void\n+Mappings::add_function_node (NodeId node_id)\n+{\n+  function_nodes.insert (node_id);\n+}\n+\n+bool\n+Mappings::is_function_node (NodeId node_id)\n+{\n+  return function_nodes.find (node_id) != function_nodes.end ();\n+}\n+\n } // namespace Analysis\n } // namespace Rust\ndiff --git a/gcc/rust/util/rust-hir-map.h b/gcc/rust/util/rust-hir-map.h\nindex c04e2efb7..7012dd5c2 100644\n--- a/gcc/rust/util/rust-hir-map.h\n+++ b/gcc/rust/util/rust-hir-map.h\n@@ -353,6 +353,9 @@ public:\n   void add_derived_node (NodeId node_id);\n   bool is_derived_node (NodeId node_id);\n \n+  void add_function_node (NodeId node_id);\n+  bool is_function_node (NodeId node_id);\n+\n private:\n   Mappings ();\n \n@@ -450,6 +453,8 @@ private:\n   std::unordered_map<NodeId, std::vector<NodeId>> captures;\n \n   std::set<NodeId> derived_nodes;\n+\n+  std::set<NodeId> function_nodes;\n };\n \n } // namespace Analysis\ndiff --git a/gcc/testsuite/rust/execute/ident_pat_vs_path_1.rs b/gcc/testsuite/rust/execute/ident_pat_vs_path_1.rs\nnew file mode 100644\nindex 000000000..479e8700b\n--- /dev/null\n+++ b/gcc/testsuite/rust/execute/ident_pat_vs_path_1.rs\n@@ -0,0 +1,27 @@\n+// { dg-additional-options \"-w\" }\n+#![feature(no_core)]\n+#![no_core]\n+\n+enum E {\n+    A,\n+    B,\n+    C\n+}\n+\n+fn main() -> i32 {\n+    use E::C;\n+\n+    let v1 = match E::A {\n+        C => 1,\n+        E::A => 0,\n+        E::B => 1\n+    };\n+\n+    let v2 = match E::A {\n+        B => 0,\n+        E::A => 1,\n+        C => 1\n+    };\n+\n+    v1 + v2\n+}\ndiff --git a/gcc/testsuite/rust/execute/ident_pat_vs_path_2.rs b/gcc/testsuite/rust/execute/ident_pat_vs_path_2.rs\nnew file mode 100644\nindex 000000000..bb6841f0a\n--- /dev/null\n+++ b/gcc/testsuite/rust/execute/ident_pat_vs_path_2.rs\n@@ -0,0 +1,18 @@\n+// { dg-additional-options \"-w\" }\n+#![feature(no_core)]\n+#![no_core]\n+\n+enum E {\n+    A,\n+    B,\n+    C\n+}\n+\n+fn main() -> i32 {\n+    use E::*;\n+\n+    match A {\n+        C => 1,\n+        _ => 0\n+    }\n+}\n",
    "prefixes": [
        "gccrs",
        "COMMIT"
    ]
}