Commit Message
Arthur Cohen
Aug. 1, 2024, 2:56 p.m. UTC
From: jjasmine <tanghocle456@gmail.com>
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
---
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 e92acdc44a1..bd889e244b0 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 3bd0102d4dc..7e0c8c6ffca 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) {}