From 21af89d773cc76eaf7240e4a16f30d4cd29139e1 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Wed, 27 Nov 2019 16:50:42 +0000 Subject: [PATCH] `UsefulWithWitness` always carries some witnesses --- src/librustc_mir/hair/pattern/check_match.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index 4463fb43583aa..56f0ace489180 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -492,7 +492,7 @@ fn check_not_useful( match is_useful(cx, matrix, &PatStack::from_pattern(&wild_pattern), ConstructWitness, hir_id) { NotUseful => Ok(()), // This is good, wildcard pattern isn't reachable. UsefulWithWitness(pats) => Err(if pats.is_empty() { - vec![wild_pattern] + bug!("Exhaustiveness check returned no witnesses") } else { pats.into_iter().map(|w| w.single_pattern()).collect() }),