diff options
author | jjasmine <tanghocle456@gmail.com> | 2024-03-09 17:16:34 -0500 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2024-03-21 14:52:42 +0000 |
commit | aa395781afdcf06cac36dec414e90c741ec5a00b (patch) | |
tree | 37f67cc5fc97adf5100b742def96607d09b7b5b3 /gcc/rust | |
parent | ac4544492688cc0dfcf7c7f8104907128aa75d89 (diff) | |
download | gcc-aa395781afdcf06cac36dec414e90c741ec5a00b.zip gcc-aa395781afdcf06cac36dec414e90c741ec5a00b.tar.gz gcc-aa395781afdcf06cac36dec414e90c741ec5a00b.tar.bz2 |
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
Diffstat (limited to 'gcc/rust')
-rw-r--r-- | gcc/rust/hir/rust-ast-lower-extern.h | 4 | ||||
-rw-r--r-- | 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 e92acdc..bd889e2 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 3bd0102..7e0c8c6 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) {} |