Message ID | 20240130121026.807464-12-arthur.cohen@embecosm.com |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1181780dyb; Tue, 30 Jan 2024 04:25:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IHieDBlVmMbYmTG8bXHZs3Vqb2xNRoYirx+P84IoSDk0KZzbxUaTL0CpsE05KlFwbg3jh2k X-Received: by 2002:a05:6214:2a4b:b0:684:d1c7:a066 with SMTP id jf11-20020a0562142a4b00b00684d1c7a066mr9532623qvb.105.1706617538924; Tue, 30 Jan 2024 04:25:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706617538; cv=pass; d=google.com; s=arc-20160816; b=yWZyVgwTCifJUP19jjzWv9rWfUPnnsDpoJYYCAMH8ZtrnYbuiva/ZHmH0yLozeGVQR CHz58MiPuyrFIzFrmhKgzlXK9CVkY427fx7hr5QtE0GrBgni9nUtYdAn1HxPxWaRMZkR 967tjxYfKBpM3nr2dnU6YZM6wskO3xAMWDjI1qU57P1jKXaXGYDsrWtEOm6NgsLw1HQ0 Q5Ujje/tMhE2kGkRJlm+rIsVEp/uQsYOqb34wRwQVZ/4igU8Y/LpuL/xEEYPe9uUb69T 8DV+FfdFM14vcAFWFCMlIRjc+zvGvbLXiUKkUtAonR/UsKsd3pYRs+KVDB8z157b50VS 42UQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:reply-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=SM5FPqGsTqK4mDPcsmuBGQtDBFibXUOYX8m/x89exW8=; fh=6KiXNvQww/MsyVplklPLl//mUuD+DtDm73nSHh4O4+g=; b=TLtVWuI7N3f2lvtQ4pWvA/sCf8iiMnyPirKCeiL9UeN90PjCV5tkaPnH+RdcVExw1U Pa3ukROaZurqn1EyGNjerOPtunHMlHX7rgqYKdiIjCEnHLsM8zWp7HvwLwQFhIncC9no ThUC9wVLCaSF7hxbwjYoXIlBC+NN/nZaQpcAOAMS1WtuQ5+ggiP5brlsyRxIyokcPTwQ lPCCE4ih7H/cO5013Nj77+Osv6PbzqOl/1lQcUxxiGPKB+6cOEB9HcEjO+q68oFj6599 /MFF8y1Su9Q0pQvslicvrHXvVDA1gLST00psci4D1aHj4n2vLDgJ1JwaKD/TmPoXQBmz I9Ug== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=CydJG1+A; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id i9-20020ad45c69000000b0068c61af4165si1175392qvh.440.2024.01.30.04.25.38 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 04:25:38 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=CydJG1+A; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 271B73858037 for <ouuuleilei@gmail.com>; Tue, 30 Jan 2024 12:25:34 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by sourceware.org (Postfix) with ESMTPS id 73703385801F for <gcc-patches@gcc.gnu.org>; Tue, 30 Jan 2024 12:10:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 73703385801F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 73703385801F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::332 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706616661; cv=none; b=V8hASwXbh8paXB5vmU8hGGn3JAfbSNXj+EbNwys6byvBmojqyn2pcgskuWoCMkfEvkfVCzzLGjqQ8grnerr5eoJYnSzCLO44xKL5ENmy7ud4JD7qTHkOoSjVZWOWVS326NAP8ICeDcB1k7kvcNfscv9ogC1HgPmODSLU6RW9YF8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706616661; c=relaxed/simple; bh=7ndiFrcraf9h3eHC9XJgGgR+8NJKjQnZTgkfmkovmAk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=QrE0vupf7eZQsehO6W8rpSII/PLrDxd2dHCzdy/7fkLxxIuhx6ppKa+kxaY6urkaIfFOCfrP7UkIFAKHYsiBE7tWcm9lUaP9Zs5MDJyRjbXxJArrcUpgIMSqJs93MMSCoPhTaa2ksl/cUlOwC0A2u9qQKhlonoE+pf8N+Kx3q3A= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40faf6788d1so1638055e9.0 for <gcc-patches@gcc.gnu.org>; Tue, 30 Jan 2024 04:10:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1706616656; x=1707221456; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=SM5FPqGsTqK4mDPcsmuBGQtDBFibXUOYX8m/x89exW8=; b=CydJG1+A6stsU+QTMlshTSksgsE5FJkIQ2hEcYl8taHEr5TQCEj0N/DoEZud1HLmpQ UlKgj0WwWPE45GyBRomYojOrZycpY0TiDeYJCGHARxw2tLrN8xkHG1K/yO7Ea6cNnB3M osKGNjVa56b6QLxt5l2CDFV1vX9j4i9G+KqejHwQ2SXlNXdSRCNthtsysV7gGSxWyNiK xeFh3L7T3R0Z6rpzAFjMkTDmklYjGleUYiU7TjppubuZwAdNk4WJ4iSH81ToJHWxCTl2 Zrrc6Mg1Oso2bKvgvB3wLCL0e1IeuYEQde9pyKXo8+O3U9TsSS/tKkBf+MRmEOZvR4JF Y/lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706616656; x=1707221456; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=SM5FPqGsTqK4mDPcsmuBGQtDBFibXUOYX8m/x89exW8=; b=frVuJdSY2IvzZxkdeJlfewzL2NRE8Bs8jm1QOtPbRZyswda3EgeSGjrhxbq3QdE4r7 D/kJvrhKQFVYfG2B8KrOxpEjURGJovYMDDxGYLQg0jKw5CctEgwbsuTmHyfY2H6rywZ1 bpwW90xEH5eDrVXoJ/2J7HTbD5o12dkNoeKEZrbU5Nc/uQ26yIz9eoMYgxVb+fElY7Az F2bpyIx1hRwqX7WfdOiiRKaRfzPQqVyWpWvMtoYhVugEUVk6+tGOaftHO7QtzJdLM/pj xH4TpFY1dkT9dQUSmODkscpkSPkVAAgSWtThQnugc/6C9r4M5rDWvH31Au1ri5lMSd7A K1Rw== X-Gm-Message-State: AOJu0YzHn9bNnpwauUCE0kkfkv1hLaKhdZCMwuO5F62QGL8dQAcoXs5b f5ygoOVglKXYuOzq7QB3vuOZhGXOVtW+bTH6Jhy8T3waJ9EFv9dBsFFADW8TPD9EwvOZZQlcDZv Nmg== X-Received: by 2002:adf:f851:0:b0:336:c79d:7504 with SMTP id d17-20020adff851000000b00336c79d7504mr1437797wrq.2.1706616656129; Tue, 30 Jan 2024 04:10:56 -0800 (PST) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id f9-20020a056000036900b00339307d9d31sm10569894wrf.112.2024.01.30.04.10.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 04:10:55 -0800 (PST) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Arthur Cohen <arthur.cohen@embecosm.com> Subject: [COMMITTED 009/101] gccrs: foreverstack: Specialize `get` for Namespace::Labels Date: Tue, 30 Jan 2024 13:06:25 +0100 Message-ID: <20240130121026.807464-12-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20240130121026.807464-2-arthur.cohen@embecosm.com> References: <20240130121026.807464-2-arthur.cohen@embecosm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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>, <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>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Reply-To: arthur.cohen@embecosm.com Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789518192518652636 X-GMAIL-MSGID: 1789518192518652636 |
Series |
[COMMITTED,001/101] gccrs: Add visibility to trait item
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Arthur Cohen
Jan. 30, 2024, 12:06 p.m. UTC
From: Arthur Cohen <arthur.cohen@embecosm.com>
gcc/rust/ChangeLog:
* resolve/rust-forever-stack.hxx: Add specific behavior for
`ForeverStack::get` when dealing with labels.
---
gcc/rust/resolve/rust-forever-stack.hxx | 29 ++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/gcc/rust/resolve/rust-forever-stack.hxx b/gcc/rust/resolve/rust-forever-stack.hxx index 806745eb908..211979fa9b9 100644 --- a/gcc/rust/resolve/rust-forever-stack.hxx +++ b/gcc/rust/resolve/rust-forever-stack.hxx @@ -208,7 +208,7 @@ ForeverStack<N>::update_cursor (Node &new_cursor) } template <Namespace N> -inline tl::optional<NodeId> +tl::optional<NodeId> ForeverStack<N>::get (const Identifier &name) { tl::optional<NodeId> resolved_node = tl::nullopt; @@ -234,6 +234,33 @@ ForeverStack<N>::get (const Identifier &name) return resolved_node; } +template <> +tl::optional<NodeId> inline ForeverStack<Namespace::Labels>::get ( + const Identifier &name) +{ + tl::optional<NodeId> resolved_node = tl::nullopt; + + reverse_iter ([&resolved_node, &name] (Node ¤t) { + // looking up for labels cannot go through function ribs + // TODO: What other ribs? + if (current.rib.kind == Rib::Kind::Function) + return KeepGoing::No; + + auto candidate = current.rib.get (name.as_string ()); + + // FIXME: Factor this in a function with the generic `get` + return candidate.map_or ( + [&resolved_node] (NodeId found) { + resolved_node = found; + + return KeepGoing::No; + }, + KeepGoing::Yes); + }); + + return resolved_node; +} + /* Check if an iterator points to the last element */ template <typename I, typename C> static bool