From patchwork Thu Aug 1 14:56:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 1967770 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=exV6rd9h; 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 4WZXfW4HD2z1ydq for ; Fri, 2 Aug 2024 01:18:27 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 682533860C37 for ; Thu, 1 Aug 2024 15:18:25 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by sourceware.org (Postfix) with ESMTPS id 4B2723860C2B for ; Thu, 1 Aug 2024 14:59:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4B2723860C2B 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 4B2723860C2B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::52c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722524403; cv=none; b=YmCWt5NJamJAbOtWJXFqpYl3/24PyW+FTTkeL1U8Aivn+b3b8XZLdFnKffv8Bs4XH+kYH9YvfOLWi3YztchwQH5JnbpMiFS1TG7nbfq5Wg2ClMY1RxwfE/iUQupEFMiCMQpQIHJU7V0XV0HO2Ppt+cJJxhZwhTojefyZ9BjGrjQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722524403; c=relaxed/simple; bh=UPMOVBFawsDfCe5CkvYC5olguD7Sa3c+U3shLxfjp44=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=DluQkGfOoX4HzEfu19x7IKDrs+V5uU+bGqMk8OSLW5A2B3LyuX4/OrkCpOBhTrL+SXTPbvJ6rsZxVRz4uAjXEOaRpy2p0whKz4bakPVpYDORKfRYwXSJemg0nNBKMmy90o4rMJQU/M7u84DUr60oW467wZCaOQCh1qknDIYBxz0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-5a156557029so11263127a12.2 for ; Thu, 01 Aug 2024 07:59:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1722524369; x=1723129169; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Wj+gIa0Eqd2hVVcoT5layBZy8QSwEAnlo0dDJvJX18M=; b=exV6rd9h97phVcWV86NZtbGQmyYS66oHMJ/ctWAooZK9sFqtGGmqSO8nMWKLbsEAA1 6PoXMvvjSEhM/aBTSUETFDYqqL+BPdK3gZ6ePikZnnZep4fbpjwO+TlTPCKnPA7RQbEx jJdDCNU+2l9X16uWrYP05oQMSfLlsiurK0N7C7Vtbv1ocyQg9iOyTczpEL7AHYdGChvk k1aS7Yy1vKAHopiI9pFzjp/JCG/BaHc35Bd5jjw3PxCun7FR6bfSncigcDIlXazrienM D9bGDn7ckk7BzjJNPHxGfZZ/k/Kd5GHZ80e515zdWphGteSLW0qhSgLgSD+aXfa75Dvc cFCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722524369; x=1723129169; h=content-transfer-encoding:mime-version: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=Wj+gIa0Eqd2hVVcoT5layBZy8QSwEAnlo0dDJvJX18M=; b=ps7viBFeNnDTXBOaaGUo4J7t5gYUwqzmZUBQhW7KBmtQVu2rab234+QD7a5yB1dzJt 81IVgsXH2Fz7j5XtG4Gw3gzaaQAZ+rjL3tIJ55NiXBLAVvTMvRXaHm+kvtAiTWOrryLv JFyl6LgrYb1kLZ7KK2SEeyoS/d9SsTQiPee7/PafOrdBfv0d/qYCBPNsncBCkoEBIHMX WJEatgIS+aR7NZTkJA9cfmMfRR2+WaHlkkDb/A8U8UOGQ35G6+0L7+tB19/zM7m02Opy EcMTikJN0Gcq7QjRJJTWBdwqdA7SkBvDAlAR4kDHJ0wxTmkMqV0eJN9DXiYFQOi+Wp22 l1DQ== X-Gm-Message-State: AOJu0YyzSdj5xDofFW6zwNYpEUx9tFYH2o8hDezi22EDhfcsK+z7kTcK pcwf8MLaotVZM61Bb7O+ClzFFWmS95p6ap+ZQliR/FHn+OSrZs/o4YPR+Dk5YNjkqeSQyzxrc16 xtzoX X-Google-Smtp-Source: AGHT+IHq1ovsvSPdlBk2q/8kD17KzWJpBmgIEHCHvPG5QfdCxep4ZRxBwJ3698hY8OswxExlzL8zlw== X-Received: by 2002:a05:6402:797:b0:5a1:5fd9:5fb7 with SMTP id 4fb4d7f45d1cf-5b7f59e2241mr384868a12.33.1722524369520; Thu, 01 Aug 2024 07:59:29 -0700 (PDT) Received: from platypus.lan ([2a04:cec2:9:dc84:3622:6733:ff49:ee91]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5ac63590592sm10252456a12.25.2024.08.01.07.59.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 07:59:29 -0700 (PDT) From: Arthur Cohen To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Arthur Cohen Subject: [PATCH 062/125] gccrs: session manager: Init Immutable name resolver. Date: Thu, 1 Aug 2024 16:56:58 +0200 Message-ID: <20240801145809.366388-64-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240801145809.366388-2-arthur.cohen@embecosm.com> References: <20240801145809.366388-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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org gcc/rust/ChangeLog: * rust-session-manager.cc (Session::compile_crate): Create an immutable view of the name resolution context. --- gcc/rust/rust-session-manager.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc index 64e0190f716..1c7e2766d71 100644 --- a/gcc/rust/rust-session-manager.cc +++ b/gcc/rust/rust-session-manager.cc @@ -18,6 +18,7 @@ #include "rust-session-manager.h" #include "rust-diagnostics.h" +#include "rust-immutable-name-resolution-context.h" #include "rust-unsafe-checker.h" #include "rust-lex.h" #include "rust-parse.h" @@ -659,6 +660,9 @@ Session::compile_crate (const char *filename) if (last_step == CompileOptions::CompileStep::TypeCheck) return; + // name resolution is done, we now freeze the name resolver for type checking + Resolver2_0::ImmutableNameResolutionContext::init (name_resolution_ctx); + // type resolve Resolver::TypeResolution::Resolve (hir);