@@ -1176,7 +1176,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1176
1176
let mut no_field_errors = true ;
1177
1177
1178
1178
let mut inexistent_fields = vec ! [ ] ;
1179
- let mut invisible_fields = vec ! [ ] ;
1180
1179
// Typecheck each field.
1181
1180
for field in fields {
1182
1181
let span = field. span ;
@@ -1192,12 +1191,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1192
1191
field_map
1193
1192
. get ( & ident)
1194
1193
. map ( |( i, f) | {
1195
- if !f
1196
- . vis
1197
- . is_accessible_from ( tcx. parent_module ( pat. hir_id ) . to_def_id ( ) , tcx)
1198
- {
1199
- invisible_fields. push ( field. ident ) ;
1200
- }
1201
1194
self . write_field_index ( field. hir_id , * i) ;
1202
1195
self . tcx . check_stability ( f. did , Some ( pat. hir_id ) , span) ;
1203
1196
self . field_ty ( span, f, substs)
@@ -1288,13 +1281,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1288
1281
self . error_tuple_variant_index_shorthand ( variant, pat, fields)
1289
1282
{
1290
1283
err. emit ( ) ;
1291
- } else if !invisible_fields. is_empty ( ) {
1292
- let mut err = self . error_invisible_fields (
1293
- adt. variant_descr ( ) ,
1294
- & invisible_fields,
1295
- variant,
1296
- ) ;
1297
- err. emit ( ) ;
1298
1284
}
1299
1285
}
1300
1286
}
@@ -1373,41 +1359,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1373
1359
. emit ( ) ;
1374
1360
}
1375
1361
1376
- fn error_invisible_fields (
1377
- & self ,
1378
- kind_name : & str ,
1379
- invisible_fields : & [ Ident ] ,
1380
- variant : & ty:: VariantDef ,
1381
- ) -> DiagnosticBuilder < ' tcx > {
1382
- let spans = invisible_fields. iter ( ) . map ( |ident| ident. span ) . collect :: < Vec < _ > > ( ) ;
1383
- let ( field_names, t) = if invisible_fields. len ( ) == 1 {
1384
- ( format ! ( "a field named `{}`" , invisible_fields[ 0 ] ) , "is" )
1385
- } else {
1386
- (
1387
- format ! (
1388
- "fields named {}" ,
1389
- invisible_fields
1390
- . iter( )
1391
- . map( |ident| format!( "`{}`" , ident) )
1392
- . collect:: <Vec <String >>( )
1393
- . join( ", " )
1394
- ) ,
1395
- "are" ,
1396
- )
1397
- } ;
1398
- let err = struct_span_err ! (
1399
- self . tcx. sess,
1400
- spans,
1401
- E0603 ,
1402
- "cannot match on {} of {} `{}`, which {} not accessible in current scope" ,
1403
- field_names,
1404
- kind_name,
1405
- self . tcx. def_path_str( variant. def_id) ,
1406
- t
1407
- ) ;
1408
- err
1409
- }
1410
-
1411
1362
fn error_inexistent_fields (
1412
1363
& self ,
1413
1364
kind_name : & str ,
0 commit comments