@@ -47,7 +47,6 @@ struct MarkSymbolVisitor<'a, 'tcx: 'a> {
4747 struct_has_extern_repr : bool ,
4848 ignore_non_const_paths : bool ,
4949 inherited_pub_visibility : bool ,
50- ignore_variant_stack : Vec < ast:: NodeId > ,
5150}
5251
5352impl < ' a , ' tcx > MarkSymbolVisitor < ' a , ' tcx > {
@@ -60,7 +59,6 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
6059 struct_has_extern_repr : false ,
6160 ignore_non_const_paths : false ,
6261 inherited_pub_visibility : false ,
63- ignore_variant_stack : vec ! [ ] ,
6462 }
6563 }
6664
@@ -81,9 +79,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
8179 def:: DefPrimTy ( _) => ( ) ,
8280 def:: DefVariant ( enum_id, variant_id, _) => {
8381 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) ;
8783 }
8884 _ => {
8985 self . check_def_id ( def. def_id ( ) ) ;
@@ -282,23 +278,6 @@ impl<'a, 'tcx, 'v> Visitor<'v> for MarkSymbolVisitor<'a, 'tcx> {
282278 visit:: walk_expr ( self , expr) ;
283279 }
284280
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-
302281 fn visit_pat ( & mut self , pat : & ast:: Pat ) {
303282 let def_map = & self . tcx . def_map ;
304283 match pat. node {
@@ -418,11 +397,6 @@ fn create_and_seed_worklist(tcx: &ty::ctxt,
418397 worklist. push ( * id) ;
419398 }
420399 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- }
426400 worklist. push ( * id) ;
427401 }
428402
0 commit comments