From 06dbaec6bfaa181cf38011f16846bc5e78031721 Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Thu, 23 Jan 2020 11:55:20 -0800 Subject: [PATCH] Only emit drop for remaining variants if they have fields. --- src/librustc_mir/util/elaborate_drops.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc_mir/util/elaborate_drops.rs b/src/librustc_mir/util/elaborate_drops.rs index aacefeb75136e..8f7b4f8ad7ee5 100644 --- a/src/librustc_mir/util/elaborate_drops.rs +++ b/src/librustc_mir/util/elaborate_drops.rs @@ -472,7 +472,7 @@ where } let (normal, _) = self.drop_ladder(fields, succ, unwind); normal_blocks.push(normal); - } else { + } else if !adt.variants[variant_index].fields.is_empty() { have_otherwise = true; } }