public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/rust/master] Store visibility properly in ExternalTypeItem
Date: Tue,  7 May 2024 16:23:20 +0000 (GMT)	[thread overview]
Message-ID: <20240507162320.C1BED386F44D@sourceware.org> (raw)

https://gcc.gnu.org/g:aa395781afdcf06cac36dec414e90c741ec5a00b

commit aa395781afdcf06cac36dec414e90c741ec5a00b
Author: jjasmine <tanghocle456@gmail.com>
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)
   {}

                 reply	other threads:[~2024-05-07 16:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240507162320.C1BED386F44D@sourceware.org \
    --to=tschwinge@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).