Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2217727/?format=api
{ "id": 2217727, "url": "http://patchwork.ozlabs.org/api/patches/2217727/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260330123236.3061-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": "<20260330123236.3061-1-gerris.rs@gmail.com>", "list_archive_url": null, "date": "2026-03-30T12:32:36", "name": "[gccrs,COMMIT] Strip down 1.0 resolver", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "5e45396e326a24ec8d14122aae70533a19b3afc5", "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/20260330123236.3061-1-gerris.rs@gmail.com/mbox/", "series": [ { "id": 498019, "url": "http://patchwork.ozlabs.org/api/series/498019/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=498019", "date": "2026-03-30T12:32:36", "name": "[gccrs,COMMIT] Strip down 1.0 resolver", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/498019/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2217727/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2217727/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=OI5ehoLu;\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=OI5ehoLu", "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.222.175" ], "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 4fkrJQ5HTRz1y1q\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 30 Mar 2026 23:33:26 +1100 (AEDT)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 8171D4B920C2\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 30 Mar 2026 12:33:24 +0000 (GMT)", "from mail-qk1-f175.google.com (mail-qk1-f175.google.com\n [209.85.222.175])\n by sourceware.org (Postfix) with ESMTPS id 9481B4BA23FE\n for <gcc-patches@gcc.gnu.org>; Mon, 30 Mar 2026 12:32:39 +0000 (GMT)", "by mail-qk1-f175.google.com with SMTP id\n af79cd13be357-8cb40149037so499295485a.2\n for <gcc-patches@gcc.gnu.org>; Mon, 30 Mar 2026 05:32:39 -0700 (PDT)", "from\n runnervmrg6be.dv0dfyhyrulupj4bql4di5djnb.ex.internal.cloudapp.net\n ([40.81.42.184]) by smtp.gmail.com with ESMTPSA id\n af79cd13be357-8d027f0a7cbsm604625585a.13.2026.03.30.05.32.37\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Mon, 30 Mar 2026 05:32:37 -0700 (PDT)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 8171D4B920C2", "OpenDKIM Filter v2.11.0 sourceware.org 9481B4BA23FE" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 9481B4BA23FE", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 9481B4BA23FE", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1774873959; cv=none;\n b=uiYUjBvFKyLwO/MCwfFXyTlklfHz2vOE8o16/RmCjTi/aLefu8qVd8/LAsU89l/5GoA+GZbpcXRGOLpbwmf+R61NBhz9mnVMA1c/PURznRgadK3P50ECPubK6w+2XbJlc9+ZAcxCanxCT/G0tzdUrbXmhyHxXccJ00J0S0g1scA=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1774873959; c=relaxed/simple;\n bh=A6IVgpKGl14hEBxG5JudTXrI1y0Q4mo9GrtkpIjUBlU=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=b2Gl/5bqiKob6UN5EK7MWn36x9fixV2irAijS2ZdpaoxNgNqbbFA2n/i5x1x6afrSXZKzRJrf+zGmqBQ3XtblU7i5gnkxUCi5Ih275L8nroT5rVvRylEim4UEVeomREWb72wAeFzP7v3d+oTxsUeaJE4mLoyz/0SxaTTtZ+VTvg=", "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=1774873959; x=1775478759; 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=DUPt1O6BUU9ZBu/+VPpw7H39K6/gNN/kq7QwLvLKsg8=;\n b=OI5ehoLuW0Tyl+34Ya/q3g2+YMfXWcPzJMvemuGgaasrmxwQJ3zHl2VTj4K5FJ3dka\n p2DppGFgTyIJHWcA4c88fHF3dTYNBk8qburixXc/ROhMuFwwIRFLbQ0YI+ZFhjDUpJdm\n HDahgckXJNDVYKlmQ5o3gOnewqloyhkl5unbRKGbXMBtWRTuruWrmcZIf5bxcGsup+9b\n dJeICWir192LmAwu/LHiH8HrL+PfpiI//NWD+8CAebX8QwaQ5qsrf+Uis47HJ9L5tj0f\n b3b+o6Y9pGShLO58h/Hj2TdjhfskQvH+wZzpSMIJjwQG0wvwTKGWPM3UxLKFZw7PIPPc\n INhA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1774873959; x=1775478759;\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=DUPt1O6BUU9ZBu/+VPpw7H39K6/gNN/kq7QwLvLKsg8=;\n b=MYFxO6+Cj7/C0hozeJDkh+wZbR5A47ETGstzBCtLIUZPmua/qcEMIpqXTyqVtbJe9n\n hN35tkdPZz54B1kUnSihLNALm5+pHHcD29qZbBLHH6tutJmtHjKsXgpdlbIizL/OrjQC\n eR5ubSy5teXF/YYQ6sHXORjaGpJGtDChHrGg7Uy72oDpCWuE/ygjlxwtek+0dqZH5+tz\n 15z5IzBqBL1zGbu5qDFy4RSAJzFfBm9wTyDpA92MzcOMa9A1rdDntX8L7+NK7Ms1IwNO\n s90k3szzbN1dywLjASXO9ysB9NogbH43cu+MPexSRiyRJvEVe/Cj74QL6+tMGu4+I4fY\n tTMA==", "X-Gm-Message-State": "AOJu0YxjhuE1kFTbZXz9SwMqnTypM8BIFqoP5BzuFjWs7sYhGNDqV4ik\n iKIakrs2C+ioaWnZqCp9RNuZ63VorASjpo7klFZrxYCC0sWlBPdTLzXWOEef2A==", "X-Gm-Gg": "ATEYQzyje0vwPEwrmJ2x01eScmx6VM0RnFdvhvRm4CmuUdgkwKc6jJnyOLFCNCtqhGM\n qD/Ux1CnuK+t0CqdahObYiX0y7obnZWA6dWHaY6rdIzPuVkoA3cLQmg9J0WJ2vJLcEPm7XH8Ghr\n ydv9f2hRX/qWcSTTs2JaG8cAKyVEjcDa4Ass8kP7h9iZm5qUjxBXjjB1WgAFPXGIgOC1dDa45+5\n 5KC05+w4eg0HtOsr2pyus0I85T2fJyRbSSBt9jYD0WUxvfj9wR19GZHRISJLWLWrSkMXMxRI+38\n aNFOogFFAkCaI40za3xs4KjzQq+yCk5SSg/uT/y90m5GmG7doFZF88PbiMvMKUK0cPSzmXJlhqG\n rlQ41T0o37mBB1X0cLUSHV9tUHIW7n4QM6AZBUEZMnyueLO1WxMufnAOPdntyDsV8tzziYOx4Cl\n VwyLYB22kRzbZkwDMH3eJsbrOA93dplruej4U3lslqgw3qYsVm9cMllVScrGf7cLQ9aFE+2X2Ic\n msQ301WDzit8q6fZEKn", "X-Received": "by 2002:a05:620a:4552:b0:8cf:eb1c:57c4 with SMTP id\n af79cd13be357-8d01c7a3811mr1512207585a.45.1774873958351;\n Mon, 30 Mar 2026 05:32:38 -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] Strip down 1.0 resolver", "Date": "Mon, 30 Mar 2026 12:32:36 +0000", "Message-ID": "<20260330123236.3061-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* expand/rust-macro-expand.cc (MacroExpander::expand_crate):\n\tRemove usage of Resolver::get_macro_scope.\n\t* resolve/rust-name-resolver.cc (Resolver::Resolver): Handle\n\tremoval of member variables.\n\t(Resolver::push_new_name_rib): Remove function definition.\n\t(Resolver::push_new_type_rib): Likewise.\n\t(Resolver::push_new_label_rib): Likewise.\n\t(Resolver::push_new_macro_rib): Likewise.\n\t(Resolver::find_name_rib): Likewise.\n\t(Resolver::find_type_rib): Likewise.\n\t(Resolver::find_macro_rib): Likewise.\n\t(Resolver::insert_builtin_types): Likewise.\n\t(Resolver::get_builtin_types): Likewise.\n\t(Resolver::generate_builtins): Likewise.\n\t(Resolver::setup_builtin): Likewise.\n\t(Resolver::insert_resolved_label): Likewise.\n\t(Resolver::lookup_resolved_label): Likewise.\n\t(Resolver::insert_resolved_macro): Likewise.\n\t(Resolver::lookup_resolved_macro): Likewise.\n\t(Resolver::push_closure_context): Likewise.\n\t(Resolver::pop_closure_context): Likewise.\n\t(Resolver::insert_captured_item): Likewise.\n\t(Resolver::decl_needs_capture): Likewise.\n\t(Resolver::get_captures): Likewise.\n\t(Resolver::insert_resolved_name): Replace function\n\timplementation with rust_unreachable call.\n\t(Resolver::lookup_resolved_name): Likewise.\n\t(Resolver::insert_resolved_type): Likewise.\n\t(Resolver::lookup_resolved_type): Likewise.\n\t(Resolver::insert_resolved_misc): Likewise.\n\t(Resolver::lookup_resolved_misc): Likewise.\n\t* resolve/rust-name-resolver.h (Resolver::insert_builtin_types):\n\tRemove member function declaration.\n\t(Resolver::get_builtin_types): Likewise.\n\t(Resolver::push_new_name_rib): Likewise.\n\t(Resolver::push_new_type_rib): Likewise.\n\t(Resolver::push_new_label_rib): Likewise.\n\t(Resolver::push_new_macro_rib): Likewise.\n\t(Resolver::find_name_rib): Likewise.\n\t(Resolver::find_type_rib): Likewise.\n\t(Resolver::find_label_rib): Likewise.\n\t(Resolver::find_macro_rib): Likewise.\n\t(Resolver::insert_resolved_label): Likewise.\n\t(Resolver::lookup_resolved_label): Likewise.\n\t(Resolver::insert_resolved_macro): Likewise.\n\t(Resolver::lookup_resolved_macro): Likewise.\n\t(Resolver::get_name_scope): Likewise.\n\t(Resolver::get_type_scope): Likewise.\n\t(Resolver::get_label_scope): Likewise.\n\t(Resolver::get_macro_scope): Likewise.\n\t(Resolver::get_global_type_node_id): Likewise.\n\t(Resolver::set_unit_type_node_id): Likewise.\n\t(Resolver::get_unit_type_node_id): Likewise.\n\t(Resolver::set_never_type_node_id): Likewise.\n\t(Resolver::get_never_type_node_id): Likewise.\n\t(Resolver::push_new_module_scope): Likewise.\n\t(Resolver::pop_module_scope): Likewise.\n\t(Resolver::peek_current_module_scope): Likewise.\n\t(Resolver::peek_crate_module_scope): Likewise.\n\t(Resolver::peek_parent_module_scope): Likewise.\n\t(Resolver::push_closure_context): Likewise.\n\t(Resolver::pop_closure_context): Likewise.\n\t(Resolver::insert_captured_item): Likewise.\n\t(Resolver::get_captures): Likewise.\n\t(Resolver::as_debug_string): Likewise.\n\t(Resolver::decl_needs_capture): Likewise.\n\t(Resolver::generate_builtins): Likewise.\n\t(Resolver::setup_builtin): Likewise.\n\t(Resolver::mappings): Remove member variable.\n\t(Resolver::tyctx): Likewise.\n\t(Resolver::builtins): Likewise.\n\t(Resolver::name_scope): Likewise.\n\t(Resolver::type_scope): Likewise.\n\t(Resolver::label_scope): Likewise.\n\t(Resolver::macro_scope): Likewise.\n\t(Resolver::global_type_node_id): Likewise.\n\t(Resolver::unit_ty_node_id): Likewise.\n\t(Resolver::never_ty_node_id): Likewise.\n\t(Resolver::name_ribs): Likewise.\n\t(Resolver::type_ribs): Likewise.\n\t(Resolver::label_ribs): Likewise.\n\t(Resolver::macro_ribs): Likewise.\n\t(Resolver::resolved_names): Likewise.\n\t(Resolver::resolved_types): Likewise.\n\t(Resolver::resolved_labels): Likewise.\n\t(Resolver::resolved_macros): Likewise.\n\t(Resolver::misc_resolved_items): Likewise.\n\t(Resolver::current_module_stack): Likewise.\n\t(Resolver::closure_context): Likewise.\n\t(Resolver::closures_capture_mappings): Likewise.\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/f2dc9871fd38139d15deba975b410f3f9adf4cfb\n\nThe commit has been mentioned in the following pull-request(s):\n - https://github.com/Rust-GCC/gccrs/pull/4506\n\n gcc/rust/expand/rust-macro-expand.cc | 3 -\n gcc/rust/resolve/rust-name-resolver.cc | 371 +------------------------\n gcc/rust/resolve/rust-name-resolver.h | 156 -----------\n 3 files changed, 7 insertions(+), 523 deletions(-)\n\n\nbase-commit: b20e3bdfe935f9c601f1488d23f4c7164bedea07", "diff": "diff --git a/gcc/rust/expand/rust-macro-expand.cc b/gcc/rust/expand/rust-macro-expand.cc\nindex af29be7d7..8f9008020 100644\n--- a/gcc/rust/expand/rust-macro-expand.cc\n+++ b/gcc/rust/expand/rust-macro-expand.cc\n@@ -345,9 +345,6 @@ MacroExpander::expand_invoc (AST::MacroInvocation &invoc,\n void\n MacroExpander::expand_crate ()\n {\n- NodeId scope_node_id = crate.get_node_id ();\n- resolver->get_macro_scope ().push (scope_node_id);\n-\n /* fill macro/decorator map from init list? not sure where init list comes\n * from? */\n \ndiff --git a/gcc/rust/resolve/rust-name-resolver.cc b/gcc/rust/resolve/rust-name-resolver.cc\nindex 3b3d976e0..be134681e 100644\n--- a/gcc/rust/resolve/rust-name-resolver.cc\n+++ b/gcc/rust/resolve/rust-name-resolver.cc\n@@ -275,14 +275,7 @@ Scope::decl_was_declared_here (NodeId def) const\n return found;\n }\n \n-Resolver::Resolver ()\n- : mappings (Analysis::Mappings::get ()), tyctx (TypeCheckContext::get ()),\n- name_scope (Scope (mappings.get_current_crate ())),\n- type_scope (Scope (mappings.get_current_crate ())),\n- label_scope (Scope (mappings.get_current_crate ())),\n- macro_scope (Scope (mappings.get_current_crate ())),\n- global_type_node_id (UNKNOWN_NODEID), unit_ty_node_id (UNKNOWN_NODEID)\n-{}\n+Resolver::Resolver () {}\n \n Resolver *\n Resolver::get ()\n@@ -294,390 +287,40 @@ Resolver::get ()\n return instance;\n }\n \n-void\n-Resolver::push_new_name_rib (Rib *r)\n-{\n- rust_assert (name_ribs.find (r->get_node_id ()) == name_ribs.end ());\n- name_ribs[r->get_node_id ()] = r;\n-}\n-\n-void\n-Resolver::push_new_type_rib (Rib *r)\n-{\n- if (type_ribs.size () == 0)\n- global_type_node_id = r->get_node_id ();\n-\n- rust_assert (type_ribs.find (r->get_node_id ()) == type_ribs.end ());\n- type_ribs[r->get_node_id ()] = r;\n-}\n-\n-void\n-Resolver::push_new_label_rib (Rib *r)\n-{\n- rust_assert (label_ribs.find (r->get_node_id ()) == label_ribs.end ());\n- label_ribs[r->get_node_id ()] = r;\n-}\n-\n-void\n-Resolver::push_new_macro_rib (Rib *r)\n-{\n- rust_assert (label_ribs.find (r->get_node_id ()) == label_ribs.end ());\n- macro_ribs[r->get_node_id ()] = r;\n-}\n-\n-bool\n-Resolver::find_name_rib (NodeId id, Rib **rib)\n-{\n- auto it = name_ribs.find (id);\n- if (it == name_ribs.end ())\n- return false;\n-\n- *rib = it->second;\n- return true;\n-}\n-\n-bool\n-Resolver::find_type_rib (NodeId id, Rib **rib)\n-{\n- auto it = type_ribs.find (id);\n- if (it == type_ribs.end ())\n- return false;\n-\n- *rib = it->second;\n- return true;\n-}\n-\n-bool\n-Resolver::find_macro_rib (NodeId id, Rib **rib)\n-{\n- auto it = macro_ribs.find (id);\n- if (it == macro_ribs.end ())\n- return false;\n-\n- *rib = it->second;\n- return true;\n-}\n-\n-void\n-Resolver::insert_builtin_types (Rib *r)\n-{\n- auto builtins = get_builtin_types ();\n- for (auto &builtin : builtins)\n- {\n- CanonicalPath builtin_path\n-\t= CanonicalPath::new_seg (builtin->get_node_id (),\n-\t\t\t\t builtin->as_string ());\n- r->insert_name (builtin_path, builtin->get_node_id (), BUILTINS_LOCATION,\n-\t\t false, Rib::ItemType::Type,\n-\t\t [] (const CanonicalPath &, NodeId, location_t) -> void {\n-\t\t });\n- }\n-}\n-\n-std::vector<AST::Type *> &\n-Resolver::get_builtin_types ()\n-{\n- return builtins;\n-}\n-\n-void\n-Resolver::generate_builtins ()\n-{\n- auto u8\n- = new TyTy::UintType (mappings.get_next_hir_id (), TyTy::UintType::U8);\n- auto u16\n- = new TyTy::UintType (mappings.get_next_hir_id (), TyTy::UintType::U16);\n- auto u32\n- = new TyTy::UintType (mappings.get_next_hir_id (), TyTy::UintType::U32);\n- auto u64\n- = new TyTy::UintType (mappings.get_next_hir_id (), TyTy::UintType::U64);\n- auto u128\n- = new TyTy::UintType (mappings.get_next_hir_id (), TyTy::UintType::U128);\n- auto i8 = new TyTy::IntType (mappings.get_next_hir_id (), TyTy::IntType::I8);\n- auto i16\n- = new TyTy::IntType (mappings.get_next_hir_id (), TyTy::IntType::I16);\n- auto i32\n- = new TyTy::IntType (mappings.get_next_hir_id (), TyTy::IntType::I32);\n- auto i64\n- = new TyTy::IntType (mappings.get_next_hir_id (), TyTy::IntType::I64);\n- auto i128\n- = new TyTy::IntType (mappings.get_next_hir_id (), TyTy::IntType::I128);\n- auto rbool = new TyTy::BoolType (mappings.get_next_hir_id ());\n- auto f32\n- = new TyTy::FloatType (mappings.get_next_hir_id (), TyTy::FloatType::F32);\n- auto f64\n- = new TyTy::FloatType (mappings.get_next_hir_id (), TyTy::FloatType::F64);\n- auto usize = new TyTy::USizeType (mappings.get_next_hir_id ());\n- auto isize = new TyTy::ISizeType (mappings.get_next_hir_id ());\n- auto char_tyty = new TyTy::CharType (mappings.get_next_hir_id ());\n- auto str = new TyTy::StrType (mappings.get_next_hir_id ());\n- auto never = new TyTy::NeverType (mappings.get_next_hir_id ());\n-\n- setup_builtin (\"u8\", u8);\n- setup_builtin (\"u16\", u16);\n- setup_builtin (\"u32\", u32);\n- setup_builtin (\"u64\", u64);\n- setup_builtin (\"u128\", u128);\n- setup_builtin (\"i8\", i8);\n- setup_builtin (\"i16\", i16);\n- setup_builtin (\"i32\", i32);\n- setup_builtin (\"i64\", i64);\n- setup_builtin (\"i128\", i128);\n- setup_builtin (\"bool\", rbool);\n- setup_builtin (\"f32\", f32);\n- setup_builtin (\"f64\", f64);\n- setup_builtin (\"usize\", usize);\n- setup_builtin (\"isize\", isize);\n- setup_builtin (\"char\", char_tyty);\n- setup_builtin (\"str\", str);\n-\n- // never type\n- NodeId never_node_id = setup_builtin (\"!\", never);\n- set_never_type_node_id (never_node_id);\n-\n- // unit type ()\n- TyTy::TupleType *unit_tyty = TyTy::TupleType::get_unit_type ();\n- std::vector<std::unique_ptr<AST::Type> > elems;\n- AST::TupleType *unit_type\n- = new AST::TupleType (std::move (elems), BUILTINS_LOCATION);\n- builtins.push_back (unit_type);\n- tyctx->insert_builtin (unit_tyty->get_ref (), unit_type->get_node_id (),\n-\t\t\t unit_tyty);\n- set_unit_type_node_id (unit_type->get_node_id ());\n-}\n-\n-NodeId\n-Resolver::setup_builtin (const std::string &name, TyTy::BaseType *tyty)\n-{\n- AST::PathIdentSegment seg (name, BUILTINS_LOCATION);\n- auto typePath = ::std::unique_ptr<AST::TypePathSegment> (\n- new AST::TypePathSegment (::std::move (seg), false, BUILTINS_LOCATION));\n- ::std::vector< ::std::unique_ptr<AST::TypePathSegment> > segs;\n- segs.push_back (::std::move (typePath));\n- auto builtin_type\n- = new AST::TypePath (::std::move (segs), BUILTINS_LOCATION, false);\n- builtins.push_back (builtin_type);\n- tyctx->insert_builtin (tyty->get_ref (), builtin_type->get_node_id (), tyty);\n- mappings.insert_node_to_hir (builtin_type->get_node_id (), tyty->get_ref ());\n- mappings.insert_canonical_path (\n- builtin_type->get_node_id (),\n- CanonicalPath::new_seg (builtin_type->get_node_id (), name));\n-\n- return builtin_type->get_node_id ();\n-}\n-\n void\n Resolver::insert_resolved_name (NodeId refId, NodeId defId)\n {\n- rust_assert (!flag_name_resolution_2_0);\n- rust_assert (resolved_names.find (refId) == resolved_names.end ());\n-\n- resolved_names[refId] = defId;\n- get_name_scope ().append_reference_for_def (refId, defId);\n- insert_captured_item (defId);\n+ rust_unreachable ();\n }\n \n bool\n Resolver::lookup_resolved_name (NodeId refId, NodeId *defId)\n {\n- rust_assert (!flag_name_resolution_2_0);\n- auto it = resolved_names.find (refId);\n- if (it == resolved_names.end ())\n- return false;\n-\n- *defId = it->second;\n- return true;\n+ rust_unreachable ();\n }\n \n void\n Resolver::insert_resolved_type (NodeId refId, NodeId defId)\n {\n- rust_assert (!flag_name_resolution_2_0);\n- rust_assert (resolved_types.find (refId) == resolved_types.end ());\n-\n- resolved_types[refId] = defId;\n- get_type_scope ().append_reference_for_def (refId, defId);\n+ rust_unreachable ();\n }\n \n bool\n Resolver::lookup_resolved_type (NodeId refId, NodeId *defId)\n {\n- rust_assert (!flag_name_resolution_2_0);\n- auto it = resolved_types.find (refId);\n- if (it == resolved_types.end ())\n- return false;\n-\n- *defId = it->second;\n- return true;\n-}\n-\n-void\n-Resolver::insert_resolved_label (NodeId refId, NodeId defId)\n-{\n- rust_assert (!flag_name_resolution_2_0);\n- auto it = resolved_labels.find (refId);\n- rust_assert (it == resolved_labels.end ());\n-\n- resolved_labels[refId] = defId;\n- get_label_scope ().append_reference_for_def (refId, defId);\n-}\n-\n-bool\n-Resolver::lookup_resolved_label (NodeId refId, NodeId *defId)\n-{\n- rust_assert (!flag_name_resolution_2_0);\n- auto it = resolved_labels.find (refId);\n- if (it == resolved_labels.end ())\n- return false;\n-\n- *defId = it->second;\n- return true;\n-}\n-\n-void\n-Resolver::insert_resolved_macro (NodeId refId, NodeId defId)\n-{\n- rust_assert (!flag_name_resolution_2_0);\n- auto it = resolved_macros.find (refId);\n- rust_assert (it == resolved_macros.end ());\n-\n- resolved_labels[refId] = defId;\n- get_label_scope ().append_reference_for_def (refId, defId);\n-}\n-\n-bool\n-Resolver::lookup_resolved_macro (NodeId refId, NodeId *defId)\n-{\n- rust_assert (!flag_name_resolution_2_0);\n- auto it = resolved_macros.find (refId);\n- if (it == resolved_macros.end ())\n- return false;\n-\n- *defId = it->second;\n- return true;\n+ rust_unreachable ();\n }\n \n void\n Resolver::insert_resolved_misc (NodeId refId, NodeId defId)\n {\n- rust_assert (!flag_name_resolution_2_0);\n- auto it = misc_resolved_items.find (refId);\n- rust_assert (it == misc_resolved_items.end ());\n-\n- misc_resolved_items[refId] = defId;\n+ rust_unreachable ();\n }\n \n bool\n Resolver::lookup_resolved_misc (NodeId refId, NodeId *defId)\n {\n- rust_assert (!flag_name_resolution_2_0);\n- auto it = misc_resolved_items.find (refId);\n- if (it == misc_resolved_items.end ())\n- return false;\n-\n- *defId = it->second;\n- return true;\n-}\n-\n-void\n-Resolver::push_closure_context (NodeId closure_expr_id)\n-{\n- auto it = closures_capture_mappings.find (closure_expr_id);\n- rust_assert (it == closures_capture_mappings.end ());\n-\n- closures_capture_mappings.insert ({closure_expr_id, {}});\n- closure_context.push_back (closure_expr_id);\n-}\n-\n-void\n-Resolver::pop_closure_context ()\n-{\n- rust_assert (!closure_context.empty ());\n- closure_context.pop_back ();\n-}\n-\n-void\n-Resolver::insert_captured_item (NodeId id)\n-{\n- // nothing to do unless we are in a closure context\n- if (closure_context.empty ())\n- return;\n-\n- // check that this is a VAR_DECL?\n- Scope &name_scope = get_name_scope ();\n- Rib::ItemType type = Rib::ItemType::Unknown;\n- bool found = name_scope.lookup_decl_type (id, &type);\n- if (!found)\n- return;\n-\n- // RIB Function { let a, let b } id = 1;\n- // RIB Closure { let c } id = 2;\n- // RIB IfStmt { <bind a>} id = 3;\n- // RIB ... { ... } id = 4\n- //\n- // if we have a resolved_node_id of 'a' and the current rib is '3' we know\n- // this is binding exists in a rib with id < the closure rib id, other wise\n- // its just a normal binding and we don't care\n- //\n- // Problem the node id's dont work like this because the inner most items are\n- // created first so this means the root will have a larger id and a simple\n- // less than or greater than check wont work for more complex scoping cases\n- // but we can use our current rib context to figure this out by checking if\n- // the rib id the decl we care about exists prior to the rib for the closure\n- // id\n-\n- const Rib *r = nullptr;\n- bool ok = name_scope.lookup_rib_for_decl (id, &r);\n- rust_assert (ok);\n- NodeId decl_rib_node_id = r->get_node_id ();\n-\n- // iterate the closure context and add in the mapping for all to handle the\n- // case of nested closures\n- for (auto &closure_expr_id : closure_context)\n- {\n- if (!decl_needs_capture (decl_rib_node_id, closure_expr_id, name_scope))\n-\tcontinue;\n-\n- // is this a valid binding to take\n- bool is_var_decl_p = type == Rib::ItemType::Var;\n- if (!is_var_decl_p)\n-\t{\n-\t // FIXME is this an error case?\n-\t return;\n-\t}\n-\n- // append it to the context info\n- auto it = closures_capture_mappings.find (closure_expr_id);\n- rust_assert (it != closures_capture_mappings.end ());\n-\n- it->second.insert (id);\n- }\n-}\n-\n-bool\n-Resolver::decl_needs_capture (NodeId decl_rib_node_id,\n-\t\t\t NodeId closure_rib_node_id, const Scope &scope)\n-{\n- for (const auto &rib : scope.get_context ())\n- {\n- bool rib_is_closure = rib->get_node_id () == closure_rib_node_id;\n- bool rib_is_decl = rib->get_node_id () == decl_rib_node_id;\n- if (rib_is_closure)\n-\treturn false;\n- else if (rib_is_decl)\n-\treturn true;\n- }\n- return false;\n-}\n-\n-const std::set<NodeId> &\n-Resolver::get_captures (NodeId id) const\n-{\n- rust_assert (!flag_name_resolution_2_0);\n-\n- auto it = closures_capture_mappings.find (id);\n- rust_assert (it != closures_capture_mappings.end ());\n- return it->second;\n+ rust_unreachable ();\n }\n \n } // namespace Resolver\ndiff --git a/gcc/rust/resolve/rust-name-resolver.h b/gcc/rust/resolve/rust-name-resolver.h\nindex bf8bfe621..6648959d6 100644\n--- a/gcc/rust/resolve/rust-name-resolver.h\n+++ b/gcc/rust/resolve/rust-name-resolver.h\n@@ -124,173 +124,17 @@ public:\n static Resolver *get ();\n ~Resolver () {}\n \n- // these builtin types\n- void insert_builtin_types (Rib *r);\n-\n- // these will be required for type resolution passes to\n- // map back to tyty nodes\n- std::vector<AST::Type *> &get_builtin_types ();\n-\n- void push_new_name_rib (Rib *r);\n- void push_new_type_rib (Rib *r);\n- void push_new_label_rib (Rib *r);\n- void push_new_macro_rib (Rib *r);\n-\n- bool find_name_rib (NodeId id, Rib **rib);\n- bool find_type_rib (NodeId id, Rib **rib);\n- bool find_label_rib (NodeId id, Rib **rib);\n- bool find_macro_rib (NodeId id, Rib **rib);\n-\n void insert_resolved_name (NodeId refId, NodeId defId);\n bool lookup_resolved_name (NodeId refId, NodeId *defId);\n \n void insert_resolved_type (NodeId refId, NodeId defId);\n bool lookup_resolved_type (NodeId refId, NodeId *defId);\n \n- void insert_resolved_label (NodeId refId, NodeId defId);\n- bool lookup_resolved_label (NodeId refId, NodeId *defId);\n-\n- void insert_resolved_macro (NodeId refId, NodeId defId);\n- bool lookup_resolved_macro (NodeId refId, NodeId *defId);\n-\n void insert_resolved_misc (NodeId refId, NodeId defId);\n bool lookup_resolved_misc (NodeId refId, NodeId *defId);\n \n- // proxy for scoping\n- Scope &get_name_scope () { return name_scope; }\n- Scope &get_type_scope () { return type_scope; }\n- Scope &get_label_scope () { return label_scope; }\n- Scope &get_macro_scope () { return macro_scope; }\n-\n- NodeId get_global_type_node_id () { return global_type_node_id; }\n-\n- void set_unit_type_node_id (NodeId id) { unit_ty_node_id = id; }\n- NodeId get_unit_type_node_id () { return unit_ty_node_id; }\n-\n- void set_never_type_node_id (NodeId id) { never_ty_node_id = id; }\n- NodeId get_never_type_node_id () { return never_ty_node_id; }\n-\n- void push_new_module_scope (NodeId module_id)\n- {\n- current_module_stack.push_back (module_id);\n- }\n-\n- void pop_module_scope ()\n- {\n- rust_assert (!current_module_stack.empty ());\n- current_module_stack.pop_back ();\n- }\n-\n- NodeId peek_current_module_scope () const\n- {\n- rust_assert (!current_module_stack.empty ());\n- return current_module_stack.back ();\n- }\n-\n- NodeId peek_crate_module_scope () const\n- {\n- rust_assert (!current_module_stack.empty ());\n- return current_module_stack.front ();\n- }\n-\n- NodeId peek_parent_module_scope () const\n- {\n- rust_assert (current_module_stack.size () > 1);\n- return current_module_stack.at (current_module_stack.size () - 2);\n- }\n-\n- void push_closure_context (NodeId closure_expr_id);\n- void pop_closure_context ();\n- void insert_captured_item (NodeId id);\n- const std::set<NodeId> &get_captures (NodeId id) const;\n-\n- std::string as_debug_string () const\n- {\n- std::stringstream ss;\n-\n- ss << \"Names:\\n\";\n- for (auto &n : name_ribs)\n- {\n-\tss << \"\\tNodeID: \" << n.first << \" Rib: \" << n.second->debug_str ()\n-\t << \"\\n\";\n- }\n- ss << \"Types:\\n\";\n- for (auto &n : type_ribs)\n- {\n-\tss << \"\\tNodeID: \" << n.first << \" Rib: \" << n.second->debug_str ()\n-\t << \"\\n\";\n- }\n- ss << \"Macros:\\n\";\n-\n- for (auto &n : macro_ribs)\n- {\n-\tss << \"\\tNodeID: \" << n.first << \" Rib: \" << n.second->debug_str ()\n-\t << \"\\n\";\n- }\n-\n- ss << \"Labels:\\n\";\n-\n- for (auto &n : label_ribs)\n- {\n-\tss << \"\\tNodeID: \" << n.first << \" Rib: \" << n.second->debug_str ()\n-\t << \"\\n\";\n- }\n-\n- return ss.str ();\n- }\n-\n-protected:\n- bool decl_needs_capture (NodeId decl_rib_node_id, NodeId closure_rib_node_id,\n-\t\t\t const Scope &scope);\n-\n private:\n Resolver ();\n-\n- void generate_builtins ();\n- NodeId setup_builtin (const std::string &name, TyTy::BaseType *tyty);\n-\n- Analysis::Mappings &mappings;\n- TypeCheckContext *tyctx;\n-\n- std::vector<AST::Type *> builtins;\n-\n- Scope name_scope;\n- Scope type_scope;\n- Scope label_scope;\n- Scope macro_scope;\n-\n- NodeId global_type_node_id;\n- NodeId unit_ty_node_id;\n- NodeId never_ty_node_id;\n-\n- // map a AST Node to a Rib\n- std::map<NodeId, Rib *> name_ribs;\n- std::map<NodeId, Rib *> type_ribs;\n- std::map<NodeId, Rib *> label_ribs;\n- std::map<NodeId, Rib *> macro_ribs;\n-\n- // Rust uses DefIds to namespace these under a crate_num\n- // but then it uses the def_collector to assign local_defids\n- // to each ast node as well. not sure if this is going to fit\n- // with gcc very well to compile a full crate in one go but we will\n- // see.\n-\n- // these are of the form ref->Def-NodeId\n- // we need two namespaces one for names and ones for types\n- std::map<NodeId, NodeId> resolved_names;\n- std::map<NodeId, NodeId> resolved_types;\n- std::map<NodeId, NodeId> resolved_labels;\n- std::map<NodeId, NodeId> resolved_macros;\n-\n- // misc\n- std::map<NodeId, NodeId> misc_resolved_items;\n-\n- // keep track of the current module scope ids\n- std::vector<NodeId> current_module_stack;\n-\n- // captured variables mappings\n- std::vector<NodeId> closure_context;\n- std::map<NodeId, std::set<NodeId>> closures_capture_mappings;\n };\n \n } // namespace Resolver\n", "prefixes": [ "gccrs", "COMMIT" ] }