Skip to content

Commit b06409e

Browse files
committed
Rename etc -> has_rest_pat
1 parent 3d83ff6 commit b06409e

File tree

1 file changed

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

1 file changed

+8
-8
lines changed

compiler/rustc_typeck/src/check/pat.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
181181
self.check_pat_tuple_struct(pat, qpath, subpats, ddpos, expected, def_bm, ti)
182182
}
183183
PatKind::Path(_) => self.check_pat_path(pat, path_res.unwrap(), expected, ti),
184-
PatKind::Struct(ref qpath, fields, etc) => {
185-
self.check_pat_struct(pat, qpath, fields, etc, expected, def_bm, ti)
184+
PatKind::Struct(ref qpath, fields, has_rest_pat) => {
185+
self.check_pat_struct(pat, qpath, fields, has_rest_pat, expected, def_bm, ti)
186186
}
187187
PatKind::Or(pats) => {
188188
let parent_pat = Some(pat);
@@ -685,7 +685,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
685685
pat: &'tcx Pat<'tcx>,
686686
qpath: &hir::QPath<'_>,
687687
fields: &'tcx [hir::PatField<'tcx>],
688-
etc: bool,
688+
has_rest_pat: bool,
689689
expected: Ty<'tcx>,
690690
def_bm: BindingMode,
691691
ti: TopInfo<'tcx>,
@@ -707,7 +707,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
707707
self.demand_eqtype_pat(pat.span, expected, pat_ty, ti);
708708

709709
// Type-check subpatterns.
710-
if self.check_struct_pat_fields(pat_ty, pat, variant, fields, etc, def_bm, ti) {
710+
if self.check_struct_pat_fields(pat_ty, &pat, variant, fields, has_rest_pat, def_bm, ti) {
711711
pat_ty
712712
} else {
713713
self.tcx.ty_error()
@@ -1189,7 +1189,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11891189
pat: &'tcx Pat<'tcx>,
11901190
variant: &'tcx ty::VariantDef,
11911191
fields: &'tcx [hir::PatField<'tcx>],
1192-
etc: bool,
1192+
has_rest_pat: bool,
11931193
def_bm: BindingMode,
11941194
ti: TopInfo<'tcx>,
11951195
) -> bool {
@@ -1263,7 +1263,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12631263

12641264
// Require `..` if struct has non_exhaustive attribute.
12651265
let non_exhaustive = variant.is_field_list_non_exhaustive() && !adt.did.is_local();
1266-
if non_exhaustive && !etc {
1266+
if non_exhaustive && !has_rest_pat {
12671267
self.error_foreign_non_exhaustive_spat(pat, adt.variant_descr(), fields.is_empty());
12681268
}
12691269

@@ -1275,7 +1275,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12751275
.struct_span_err(pat.span, "union patterns should have exactly one field")
12761276
.emit();
12771277
}
1278-
if etc {
1278+
if has_rest_pat {
12791279
tcx.sess.struct_span_err(pat.span, "`..` cannot be used in union patterns").emit();
12801280
}
12811281
} else if !unmentioned_fields.is_empty() {
@@ -1287,7 +1287,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12871287
})
12881288
.collect();
12891289

1290-
if !etc {
1290+
if !has_rest_pat {
12911291
if accessible_unmentioned_fields.is_empty() {
12921292
unmentioned_err = Some(self.error_no_accessible_fields(pat, fields));
12931293
} else {

0 commit comments

Comments
 (0)