From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id C1BED386F44D; Tue, 7 May 2024 16:23:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C1BED386F44D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1715099000; bh=gMl8NRAgwWzzIJ/JCGMVeyfD8IHkWbV8BRjNok1t3pI=; h=From:To:Subject:Date:From; b=FCTUlVDsggD8k6uoUDUZJU3sydqNFAJbNfGh3ulYtY9BOqIHT+uwDmKSi+yC+tzjq ZWCWLfsIbHNalqf6iZutezvstpT9qgfzVp5hWLOybEg6rVb2zo0sz8/C8SifNFNJ0+ UrmTaRkSdiE2XYxyVeYLpHACxeUjJD1HjKBkeGEg= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Thomas Schwinge To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] Store visibility properly in ExternalTypeItem X-Act-Checkin: gcc X-Git-Author: jjasmine X-Git-Refname: refs/heads/devel/rust/master X-Git-Oldrev: ac4544492688cc0dfcf7c7f8104907128aa75d89 X-Git-Newrev: aa395781afdcf06cac36dec414e90c741ec5a00b Message-Id: <20240507162320.C1BED386F44D@sourceware.org> Date: Tue, 7 May 2024 16:23:20 +0000 (GMT) List-Id: https://gcc.gnu.org/g:aa395781afdcf06cac36dec414e90c741ec5a00b commit aa395781afdcf06cac36dec414e90c741ec5a00b Author: jjasmine Date: Sat Mar 9 17:16:34 2024 -0500 Store visibility properly in ExternalTypeItem Fix issue 2897 gcc/rust/ChangeLog: * hir/rust-ast-lower-extern.h: Add translate_visiblity * hir/tree/rust-hir-item.h: Fix constructor of ExternalTypeItem Diff: --- gcc/rust/hir/rust-ast-lower-extern.h | 4 +++- gcc/rust/hir/tree/rust-hir-item.h | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gcc/rust/hir/rust-ast-lower-extern.h b/gcc/rust/hir/rust-ast-lower-extern.h index e92acdc44a1f..bd889e244b01 100644 --- a/gcc/rust/hir/rust-ast-lower-extern.h +++ b/gcc/rust/hir/rust-ast-lower-extern.h @@ -133,8 +133,10 @@ public: mappings->get_next_hir_id (crate_num), mappings->get_next_localdef_id (crate_num)); + HIR::Visibility vis = translate_visibility (type.get_visibility ()); + translated = new HIR::ExternalTypeItem (mapping, type.get_identifier (), - type.get_locus ()); + vis, type.get_locus ()); } private: diff --git a/gcc/rust/hir/tree/rust-hir-item.h b/gcc/rust/hir/tree/rust-hir-item.h index 3bd0102d4dcf..7e0c8c6ffca9 100644 --- a/gcc/rust/hir/tree/rust-hir-item.h +++ b/gcc/rust/hir/tree/rust-hir-item.h @@ -3154,9 +3154,9 @@ class ExternalTypeItem : public ExternalItem { public: ExternalTypeItem (Analysis::NodeMapping mappings, Identifier item_name, - location_t locus) + Visibility vis, location_t locus) : ExternalItem (std::move (mappings), std::move (item_name), - Visibility (Visibility::PRIVATE), + Visibility (std::move (vis)), /* FIXME: Is that correct? */ {}, locus) {}