Resolve enum field visibility correctly
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:
parent
2225ee1b62
commit
5ce3f4c166
5 changed files with 75 additions and 3 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue