@@ -47,7 +47,6 @@ struct MarkSymbolVisitor<'a, 'tcx: 'a> {
47
47
struct_has_extern_repr : bool ,
48
48
ignore_non_const_paths : bool ,
49
49
inherited_pub_visibility : bool ,
50
- ignore_variant_stack : Vec < ast:: NodeId > ,
51
50
}
52
51
53
52
impl < ' a , ' tcx > MarkSymbolVisitor < ' a , ' tcx > {
@@ -60,7 +59,6 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
60
59
struct_has_extern_repr : false ,
61
60
ignore_non_const_paths : false ,
62
61
inherited_pub_visibility : false ,
63
- ignore_variant_stack : vec ! [ ] ,
64
62
}
65
63
}
66
64
@@ -81,9 +79,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
81
79
def:: DefPrimTy ( _) => ( ) ,
82
80
def:: DefVariant ( enum_id, variant_id, _) => {
83
81
self . check_def_id ( enum_id) ;
84
- if !self . ignore_variant_stack . contains ( & variant_id. node ) {
85
- self . check_def_id ( variant_id) ;
86
- }
82
+ self . check_def_id ( variant_id) ;
87
83
}
88
84
_ => {
89
85
self . check_def_id ( def. def_id ( ) ) ;
@@ -282,23 +278,6 @@ impl<'a, 'tcx, 'v> Visitor<'v> for MarkSymbolVisitor<'a, 'tcx> {
282
278
visit:: walk_expr ( self , expr) ;
283
279
}
284
280
285
- fn visit_arm ( & mut self , arm : & ast:: Arm ) {
286
- if arm. pats . len ( ) == 1 {
287
- let pat = & * arm. pats [ 0 ] ;
288
- let variants = pat_util:: necessary_variants ( & self . tcx . def_map , pat) ;
289
-
290
- // Inside the body, ignore constructions of variants
291
- // necessary for the pattern to match. Those construction sites
292
- // can't be reached unless the variant is constructed elsewhere.
293
- let len = self . ignore_variant_stack . len ( ) ;
294
- self . ignore_variant_stack . push_all ( & * variants) ;
295
- visit:: walk_arm ( self , arm) ;
296
- self . ignore_variant_stack . truncate ( len) ;
297
- } else {
298
- visit:: walk_arm ( self , arm) ;
299
- }
300
- }
301
-
302
281
fn visit_pat ( & mut self , pat : & ast:: Pat ) {
303
282
let def_map = & self . tcx . def_map ;
304
283
match pat. node {
@@ -418,11 +397,6 @@ fn create_and_seed_worklist(tcx: &ty::ctxt,
418
397
worklist. push ( * id) ;
419
398
}
420
399
for id in reachable_symbols {
421
- // Reachable variants can be dead, because we warn about
422
- // variants never constructed, not variants never used.
423
- if let Some ( ast_map:: NodeVariant ( ..) ) = tcx. map . find ( * id) {
424
- continue ;
425
- }
426
400
worklist. push ( * id) ;
427
401
}
428
402
0 commit comments