From patchwork Tue Jan 30 12:06:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 1892847 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256 header.s=google header.b=LTH9I/KL; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TPPbN4rJhz23gZ for ; Tue, 30 Jan 2024 23:28:32 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A9B36386C59E for ; Tue, 30 Jan 2024 12:28:30 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id AE6A53857BBD for ; Tue, 30 Jan 2024 12:11:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AE6A53857BBD 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 AE6A53857BBD Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::42c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706616706; cv=none; b=O3mvoPp48LiLY+7H0j3mYR3aGmmyBdTCHRURARykEF7twg4gS8rnEWr0bw8u6gv7Ll31eQ5Id9ohGPvR/v3Xfg22YdCeOcycva8CfupNUmv6ZDITPTD5MY3aCugbBvsf+w6HtliRCggoLZX6afpsOlZPCLT24XKfv1aZt2ogBEk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706616706; c=relaxed/simple; bh=GyOCtN1nI3fsNEIJ29hgyTjw2Ha1yrjAh2NplTYbg4Y=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=goN7AuIFM1/CsxDtzuHT0ttYHxuFpBsMfc2Yxe/UjD/irS0aNksr6HmQelvimTVcgSlkUdLEByjUJwRv9rbUXWIMpxM34Grxi+FVXOwtXpX3SbQ5gZMzo+Eoij7kPk5ls8zMh9RpIFfQgy64A/upN6jeaTjamdw5+QKVH8NOioA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-33ae53eb5a8so1724757f8f.3 for ; Tue, 30 Jan 2024 04:11:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1706616680; x=1707221480; 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=BKw4sa3FTLYF2rhnjQmhSXdN1b9XclNq5ftM6eb8W9Q=; b=LTH9I/KL9LozJkXLRVOVu3EHxVcgaH3RNSk9sDE4iTD5ZFluYJOO2OTx6saT4BOzue GieB8HIUmb9HRNwm7wdRthJAboDTgDwqUKxHRk/bp6q1LE1A8CS0ggrE8wL8107dwoHf AVcyKyHzg34AIlPoNAY6qaMuBY1GZgewagH+ESb0qidt+eJV28yZ/4l9KKEp3RabcHYg xPf8J3Mq5ntWEKW+8XsJq+nSbWKj4ZeGFFvUWhTlImqj2FXDwAhivKovaQ8VyY8oPI9q zAvuVfaOq04IZfzUdvqMxh7w0l7FPFBIeltHZjCZAYbT2itHWGjBEHWE0C6Ov1egkW+X 0ZwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706616680; x=1707221480; 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=BKw4sa3FTLYF2rhnjQmhSXdN1b9XclNq5ftM6eb8W9Q=; b=PeEg+sSjixyOxl9GKvcbssTYJnbrzj7qsHA86e2+mYNj+curIdFx6qHG3YVseOzNup 56uA40iW6gyIw/DURvR0lj3PKNRsY5u6e6DAYcdKRWpluKaI0LD8RQGCigWbiSns9WXj k9+XnlDAAdVZMtFnb0c/A3RVPOXzCcsjkQenPro8glW48KVhJoW46+GKbzOBM1AWDQU6 hBTcXXMO5olAZXOjO8TDWRW86udUiIqLbpDc/Slllh/782xJE2g4+FBDrIBGdXjV90nG bylSoN1uzP9+VBF6NqKuW5teVP56zwE0jamsaaNtNMDFT1hCqN2EQepLUPNU0rSiJ6L9 HiGw== X-Gm-Message-State: AOJu0YxfoiLq4Q1fzBZMxKSSgFEzZD1GW3pYxFB4ameBznVqpfJZbs8K 0A9uVi1JflFKJPKLhdubUhorSklK9cYr8ygMhyxddc7xUcwQJyXk+zdrqerdAkAjEi6ywwhCD2a ITw== X-Google-Smtp-Source: AGHT+IG8YGXgjWBu8GKetMO/W4lRqcT541+XQR+Gu21eauJznh3+mbruLXOVfGyfJluo+5hzYjakqQ== X-Received: by 2002:adf:f2c2:0:b0:337:7b14:d9fc with SMTP id d2-20020adff2c2000000b003377b14d9fcmr6410169wrp.12.1706616680671; Tue, 30 Jan 2024 04:11:20 -0800 (PST) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id f9-20020a056000036900b00339307d9d31sm10569894wrf.112.2024.01.30.04.11.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 04:11:19 -0800 (PST) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Arthur Cohen Subject: [COMMITTED 040/101] gccrs: toplevel: Add comment about running the collector twice Date: Tue, 30 Jan 2024 13:06:56 +0100 Message-ID: <20240130121026.807464-43-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 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=ham 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: arthur.cohen@embecosm.com Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org From: Arthur Cohen gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::insert_or_error_out): Add documentation comment. (TopLevel::go): Likewise. --- gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc index fbded3e49e1..b9d0bc7c0ac 100644 --- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc +++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc @@ -43,6 +43,9 @@ TopLevel::insert_or_error_out (const Identifier &identifier, const T &node, if (!result) { + // can we do something like check if the node id is the same? if it is the + // same, it's not an error, just the resolver running multiple times? + rich_location rich_loc (line_table, loc); rich_loc.add_range (node_locations[result.error ().existing]); @@ -54,6 +57,11 @@ TopLevel::insert_or_error_out (const Identifier &identifier, const T &node, void TopLevel::go (AST::Crate &crate) { + // we do not include builtin types in the top-level definition collector, as + // they are not used until `Late`. furthermore, we run this visitor multiple + // times in a row in a fixed-point fashion, so it would make the code + // responsible for this ugly and perfom a lot of error checking. + for (auto &item : crate.items) item->accept_vis (*this); }