`UsefulWithWitness` always carries some witnesses

This commit is contained in:
Nadrieril 2019-11-27 16:50:42 +00:00
parent fe67196679
commit 21af89d773
1 changed files with 1 additions and 1 deletions

View File

@ -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()
}),