Skip to content

Commit f7a8980

Browse files
committed
Reorder etc check for non_exhaustive_omitted_patterns
1 parent 8cbcc89 commit f7a8980

File tree

1 file changed

+8
-7
lines changed
  • compiler/rustc_typeck/src/check

1 file changed

+8
-7
lines changed

compiler/rustc_typeck/src/check/pat.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -1286,13 +1286,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12861286
field.vis.is_accessible_from(tcx.parent_module(pat.hir_id).to_def_id(), tcx)
12871287
})
12881288
.collect();
1289-
if non_exhaustive && !accessible_unmentioned_fields.is_empty() {
1290-
self.lint_non_exhaustive_omitted_patterns(
1291-
pat,
1292-
&accessible_unmentioned_fields,
1293-
adt_ty,
1294-
)
1295-
} else if !etc {
1289+
1290+
if !etc {
12961291
if accessible_unmentioned_fields.is_empty() {
12971292
unmentioned_err = Some(self.error_no_accessible_fields(pat, fields));
12981293
} else {
@@ -1303,6 +1298,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13031298
fields,
13041299
));
13051300
}
1301+
} else if non_exhaustive && !accessible_unmentioned_fields.is_empty() {
1302+
self.lint_non_exhaustive_omitted_patterns(
1303+
pat,
1304+
&accessible_unmentioned_fields,
1305+
adt_ty,
1306+
)
13061307
}
13071308
}
13081309
match (inexistent_fields_err, unmentioned_err) {

0 commit comments

Comments
 (0)