diff options
Diffstat (limited to 'crates/hir_def/src/item_tree/lower.rs')
-rw-r--r-- | crates/hir_def/src/item_tree/lower.rs | 9 |
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))) |