1
Fork 0

Auto merge of #79956 - camelid:variant-field-vis, r=petrochenkov

Resolve enum field visibility correctly

Fixes #79593. 🎉

Previously, this code treated enum fields' visibility as if they were
struct fields. However, that's not correct because the visibility of a
struct field with `ast::VisibilityKind::Inherited` is private to the
module it's defined in, whereas the visibility of an *enum* field with
`ast::VisibilityKind::Inherited` is the visibility of the enum it
belongs to.
This commit is contained in:
bors 2020-12-13 08:40:07 +00:00
commit d149b6579f
5 changed files with 75 additions and 3 deletions

View file

@ -1248,7 +1248,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
if no_accessible_remaining_fields {
self.report_no_accessible_fields(adt_ty, span);
} else {
self.report_missing_field(adt_ty, span, remaining_fields);
self.report_missing_fields(adt_ty, span, remaining_fields);
}
}
@ -1279,7 +1279,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
///
/// error: aborting due to previous error
/// ```
fn report_missing_field(
fn report_missing_fields(
&self,
adt_ty: Ty<'tcx>,
span: Span,