@@ -181,8 +181,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
181
181
self . check_pat_tuple_struct ( pat, qpath, subpats, ddpos, expected, def_bm, ti)
182
182
}
183
183
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)
186
186
}
187
187
PatKind :: Or ( pats) => {
188
188
let parent_pat = Some ( pat) ;
@@ -685,7 +685,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
685
685
pat : & ' tcx Pat < ' tcx > ,
686
686
qpath : & hir:: QPath < ' _ > ,
687
687
fields : & ' tcx [ hir:: PatField < ' tcx > ] ,
688
- etc : bool ,
688
+ has_rest_pat : bool ,
689
689
expected : Ty < ' tcx > ,
690
690
def_bm : BindingMode ,
691
691
ti : TopInfo < ' tcx > ,
@@ -707,7 +707,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
707
707
self . demand_eqtype_pat ( pat. span , expected, pat_ty, ti) ;
708
708
709
709
// 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) {
711
711
pat_ty
712
712
} else {
713
713
self . tcx . ty_error ( )
@@ -1189,7 +1189,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1189
1189
pat : & ' tcx Pat < ' tcx > ,
1190
1190
variant : & ' tcx ty:: VariantDef ,
1191
1191
fields : & ' tcx [ hir:: PatField < ' tcx > ] ,
1192
- etc : bool ,
1192
+ has_rest_pat : bool ,
1193
1193
def_bm : BindingMode ,
1194
1194
ti : TopInfo < ' tcx > ,
1195
1195
) -> bool {
@@ -1263,7 +1263,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1263
1263
1264
1264
// Require `..` if struct has non_exhaustive attribute.
1265
1265
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 {
1267
1267
self . error_foreign_non_exhaustive_spat ( pat, adt. variant_descr ( ) , fields. is_empty ( ) ) ;
1268
1268
}
1269
1269
@@ -1275,7 +1275,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1275
1275
. struct_span_err ( pat. span , "union patterns should have exactly one field" )
1276
1276
. emit ( ) ;
1277
1277
}
1278
- if etc {
1278
+ if has_rest_pat {
1279
1279
tcx. sess . struct_span_err ( pat. span , "`..` cannot be used in union patterns" ) . emit ( ) ;
1280
1280
}
1281
1281
} else if !unmentioned_fields. is_empty ( ) {
@@ -1287,7 +1287,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1287
1287
} )
1288
1288
. collect ( ) ;
1289
1289
1290
- if !etc {
1290
+ if !has_rest_pat {
1291
1291
if accessible_unmentioned_fields. is_empty ( ) {
1292
1292
unmentioned_err = Some ( self . error_no_accessible_fields ( pat, fields) ) ;
1293
1293
} else {
0 commit comments