aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/item_tree/lower.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-06-03 13:27:57 +0100
committerGitHub <[email protected]>2021-06-03 13:27:57 +0100
commit23b48d377d295c7ff5b59246788f0627d3726b5b (patch)
treeda6ad57db8b0b4d0a4994534883e380a6fa65efa /crates/hir_def/src/item_tree/lower.rs
parent48ea50bf04a1bd12999bd9e27558ac31988c7228 (diff)
parent28e3e683b204050e532f49f84f2ec887f19cc91c (diff)
Merge #9127
9127: internal: make variant fields inherit the enum's visibility in the ItemTree r=jonas-schievink a=jonas-schievink No observable changes from what I can tell, but this is "more correct". bors r+ Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/hir_def/src/item_tree/lower.rs')
-rw-r--r--crates/hir_def/src/item_tree/lower.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/crates/hir_def/src/item_tree/lower.rs b/crates/hir_def/src/item_tree/lower.rs
index 6208facd5..0e467d907 100644
--- a/crates/hir_def/src/item_tree/lower.rs
+++ b/crates/hir_def/src/item_tree/lower.rs
@@ -276,10 +276,11 @@ impl<'a> Ctx<'a> {
276 let visibility = self.lower_visibility(enum_); 276 let visibility = self.lower_visibility(enum_);
277 let name = enum_.name()?.as_name(); 277 let name = enum_.name()?.as_name();
278 let generic_params = self.lower_generic_params(GenericsOwner::Enum, enum_); 278 let generic_params = self.lower_generic_params(GenericsOwner::Enum, enum_);
279 let variants = match &enum_.variant_list() { 279 let variants =
280 Some(variant_list) => self.lower_variants(variant_list), 280 self.with_inherited_visibility(visibility, |this| match &enum_.variant_list() {
281 None => IdRange::new(self.next_variant_idx()..self.next_variant_idx()), 281 Some(variant_list) => this.lower_variants(variant_list),
282 }; 282 None => IdRange::new(this.next_variant_idx()..this.next_variant_idx()),
283 });
283 let ast_id = self.source_ast_id_map.ast_id(enum_); 284 let ast_id = self.source_ast_id_map.ast_id(enum_);
284 let res = Enum { name, visibility, generic_params, variants, ast_id }; 285 let res = Enum { name, visibility, generic_params, variants, ast_id };
285 Some(id(self.data().enums.alloc(res))) 286 Some(id(self.data().enums.alloc(res)))