Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2223283/?format=api
{ "id": 2223283, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2223283/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260414231905.191063-16-arthur.cohen@embecosm.com/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/1.2/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": "<20260414231905.191063-16-arthur.cohen@embecosm.com>", "list_archive_url": null, "date": "2026-04-14T23:18:37", "name": "[COMMITTED,16/43] gccrs: Strip down 1.0 resolver", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "5e45396e326a24ec8d14122aae70533a19b3afc5", "submitter": { "id": 83476, "url": "http://patchwork.ozlabs.org/api/1.2/people/83476/?format=api", "name": "Arthur Cohen", "email": "arthur.cohen@embecosm.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260414231905.191063-16-arthur.cohen@embecosm.com/mbox/", "series": [ { "id": 499900, "url": "http://patchwork.ozlabs.org/api/1.2/series/499900/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=499900", "date": "2026-04-14T23:18:24", "name": "[COMMITTED,01/43] gccrs: testsuite:Add a testcase for setup_associated_types", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/499900/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2223283/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2223283/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=embecosm.com header.i=@embecosm.com header.a=rsa-sha256\n header.s=google header.b=cQ1KYcFI;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.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=embecosm.com header.i=@embecosm.com header.a=rsa-sha256\n header.s=google header.b=cQ1KYcFI", "sourceware.org;\n dmarc=none (p=none dis=none) header.from=embecosm.com", "sourceware.org; spf=pass smtp.mailfrom=embecosm.com", "server2.sourceware.org;\n arc=none smtp.remote-ip=209.85.128.66" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org [38.145.34.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 4fwKzk1rxlz1yHM\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 15 Apr 2026 09:21:54 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 4A8CE4BA23D0\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 14 Apr 2026 23:21:52 +0000 (GMT)", "from mail-wm1-f66.google.com (mail-wm1-f66.google.com\n [209.85.128.66])\n by sourceware.org (Postfix) with ESMTPS id 0E2AA4BA2E23\n for <gcc-patches@gcc.gnu.org>; Tue, 14 Apr 2026 23:14:33 +0000 (GMT)", "by mail-wm1-f66.google.com with SMTP id\n 5b1f17b1804b1-488a29e6110so66402955e9.3\n for <gcc-patches@gcc.gnu.org>; Tue, 14 Apr 2026 16:14:32 -0700 (PDT)", "from platypus.localdomain (176-147-231-59.abo.bbox.fr.\n [176.147.231.59]) by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-488f1dd8806sm3325945e9.3.2026.04.14.16.14.30\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 14 Apr 2026 16:14:30 -0700 (PDT)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 4A8CE4BA23D0", "OpenDKIM Filter v2.11.0 sourceware.org 0E2AA4BA2E23" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 0E2AA4BA2E23", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 0E2AA4BA2E23", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776208473; cv=none;\n b=Na2WnY7F8l9Ytl2QXBhRcIx0LOFKEStiI5uERZF9RShcXy5GI5JBP+PI4K2E91Lm9g2WthFv1Pado+aMbYFP1OY4AMLm69mSeCBfH0HvKCc2rLsaZKBbBZRK46rGEWrRRPTxldSAFMA4quaQs9cz+SCLd2Dig3zMPWJGk1jqobU=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776208473; c=relaxed/simple;\n bh=jyQZJxBZRSFUEKz6w1PBCWenXMjYdUMmmvl4ylXnxCM=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=qBzMDgATAd93K6quT2c+E647F2wKS4YIxsMeuy3cQcGK+RSIYnmCKPJwJ1moi7t/dfoJ2ixt5TXeXUdDL0rR1NqxyQKiX9bqwB8KSKZLJMHPnc5TnIOvf2ym3LuzR1QsKzKxu+48/jGdl+NDgTTFdlvsOCLVZm872YFbibS74AY=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=embecosm.com; s=google; t=1776208472; x=1776813272; darn=gcc.gnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=Nc4/qfna3kke/RmFjpsm2wo0XMLOwKCatcIQko3GYDQ=;\n b=cQ1KYcFIk8KhQ5yQNx9CpY6bi2DzzfmVQfDu9i8KsgRq1jc6gIuWTzGiusTZX+MMCk\n OJVSBYpmaAw+WDl/ZV18YXTu2VD92fX2+u+lgcDPSKXZobB8yeVLXPc3u6wZ0wq2gubQ\n bzlXRf5zpQL9hiz93r5eQYRSD+ewyzCTB4VJytbXiKU7baUxN0b4KQjsCNoIfNp1edTT\n 5vamTXqt/qh3HB4CbW7OhQoM9GJIMB8QXew/+1pUFeyJiHJO2dY1HOyTPgOscTexfsdf\n e+hdk7uGoZ/2UKSACdW7Mmi9f8KAubUufDSDR5xw+2UT66PR4y0wIjeafyibkvOMpION\n Sixg==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776208472; x=1776813272;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=Nc4/qfna3kke/RmFjpsm2wo0XMLOwKCatcIQko3GYDQ=;\n b=s5FbnDWROMvpbkaTdJmaJQmuTakqQz2RjjTzRSXj7m/+5WtWSYZl7O58ny2ik0oK7L\n QiqhHKxXi6e+U/uRhLIEvzYee8QNXCxyFl/KpSJt2Bi+efToOF4LS7IK2+EcGprAeLWi\n qZQ5o5SNzPbbvVbuAv0GRd1GeRUVV67Ergj3zV03UMuWlLTiDO1+runqPWZeDFtnUZHP\n PC/HP98b4TQQOYvHKwUfMyIgiDK+xR83/nKKicw/uPY3gZpf4wc6eRA6VZnR+Y7IG+43\n Y2ZdTkMnK0SLVOapl/j/gm4SzTYsRuo7xTiqUnzQJc9GpZCCY3Us5V9MGO1zpxc5U5zM\n 83Zg==", "X-Gm-Message-State": "AOJu0Yx87CAeDtOk5z76vw6jlW5aer6OXNdBHDMTI3DwP/TQjCwakc2K\n +RE3zmLUlEx7ckfSA9rAusBb91AZ/FbesCp63+PDDR6M7EMkSZxQxxNoa94WZ3dRpdvG9Y5qUye\n DOt8+Dm3+", "X-Gm-Gg": "AeBDieuIa/tqznMnsKyw/vUGtUi4I0T5FBQtv17BBH5JCJI8UHX+Boetnhm0fAFfMBS\n FtAIJEMesxV21mNl4QVZISdQiwrI31f5t3OVi1XdKpcWOnKUK/NXv0HMdH2udpC65UonLDiw72h\n ujXa53W3wX5b3i776BoVdNt7DJ2H81sUXYA3mzJ+yXHMQ5GRuQBaYv3sAAqvuFW9DgZauj4Clmg\n jUSi3viPyco64LlYTgZxy/gHZG7ZHp7HLgWbqy34sqRQmqyZgqZk5drKtlMVebwTQEuLKk1Ivje\n MNhwFB6l+l5E1wA/DKDKBnw0oIRABNE/vk1PJSy1W2g1CL1VMPRTS/zGWWhWB6XSCBKC8RdRhsE\n DWZEJenTv1xmqcMXqz8mctP8Ouvo40QJYLKi6Uc5L+Pp7qGAchkDr+MfPG+a7Mir0kPx+XXpVVc\n UfRHEuG8OngyC8o9SUhGhsiOwgkF3EI+UoH8UsiHo8hrTb/RSK1fGUnMkG+fiZtvDXOrLWLuoX9\n eDniA==", "X-Received": "by 2002:a05:600c:a11c:b0:488:af14:f1da with SMTP id\n 5b1f17b1804b1-488d67f9a25mr192422275e9.7.1776208471547;\n Tue, 14 Apr 2026 16:14:31 -0700 (PDT)", "From": "arthur.cohen@embecosm.com", "To": "gcc-patches@gcc.gnu.org", "Cc": "gcc-rust@gcc.gnu.org,\n\tOwen Avery <powerboat9.gamer@gmail.com>", "Subject": "[COMMITTED 16/43] gccrs: Strip down 1.0 resolver", "Date": "Wed, 15 Apr 2026 01:18:37 +0200", "Message-ID": "<20260414231905.191063-16-arthur.cohen@embecosm.com>", "X-Mailer": "git-send-email 2.50.1", "In-Reply-To": "<20260414231905.191063-1-arthur.cohen@embecosm.com>", "References": "<20260414231905.191063-1-arthur.cohen@embecosm.com>", "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---\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(-)", "diff": "diff --git a/gcc/rust/expand/rust-macro-expand.cc b/gcc/rust/expand/rust-macro-expand.cc\nindex af29be7d704..8f900802087 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 3b3d976e012..be134681e34 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 bf8bfe621c4..6648959d62f 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": [ "COMMITTED", "16/43" ] }