Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Reorder etc check for non_exhaustive_omitted_patterns
  • Loading branch information
DevinR528 committed Oct 2, 2021
commit f7a8980347f83d2602161e5617c5af4c06d80747
15 changes: 8 additions & 7 deletions compiler/rustc_typeck/src/check/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1286,13 +1286,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
field.vis.is_accessible_from(tcx.parent_module(pat.hir_id).to_def_id(), tcx)
})
.collect();
if non_exhaustive && !accessible_unmentioned_fields.is_empty() {
self.lint_non_exhaustive_omitted_patterns(
pat,
&accessible_unmentioned_fields,
adt_ty,
)
} else if !etc {

if !etc {
if accessible_unmentioned_fields.is_empty() {
unmentioned_err = Some(self.error_no_accessible_fields(pat, fields));
} else {
Expand All @@ -1303,6 +1298,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
fields,
));
}
} else if non_exhaustive && !accessible_unmentioned_fields.is_empty() {
self.lint_non_exhaustive_omitted_patterns(
pat,
&accessible_unmentioned_fields,
adt_ty,
)
}
}
match (inexistent_fields_err, unmentioned_err) {
Expand Down