From 0010fc8fec235d36d9264de07dbad4508eda0a8e Mon Sep 17 00:00:00 2001 From: Simon Vandel Sillesen Date: Mon, 28 Dec 2020 23:19:35 +0100 Subject: [PATCH] use exhaustive pattern match to prevent future bugs --- compiler/rustc_mir/src/transform/instcombine.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_mir/src/transform/instcombine.rs b/compiler/rustc_mir/src/transform/instcombine.rs index 04ea2bb542e..47695985386 100644 --- a/compiler/rustc_mir/src/transform/instcombine.rs +++ b/compiler/rustc_mir/src/transform/instcombine.rs @@ -301,9 +301,18 @@ struct OptimizationList<'tcx> { impl<'tcx> OptimizationList<'tcx> { fn is_empty(&self) -> bool { - self.and_stars.is_empty() - && self.arrays_lengths.is_empty() - && self.unneeded_equality_comparison.is_empty() - && self.unneeded_deref.is_empty() + match self { + OptimizationList { + and_stars, + arrays_lengths, + unneeded_equality_comparison, + unneeded_deref, + } => { + and_stars.is_empty() + && arrays_lengths.is_empty() + && unneeded_equality_comparison.is_empty() + && unneeded_deref.is_empty() + } + } } }