Skip to content

Commit a134f16

Browse files
committed
1 parent 26f340a commit a134f16

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

compiler/rustc_mir_build/src/thir/pattern/usefulness.rs

+3
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,9 @@ fn collect_nonexhaustive_missing_variants<'p, 'tcx>(
884884
cx: &MatchCheckCtxt<'p, 'tcx>,
885885
column: &[&DeconstructedPat<'p, 'tcx>],
886886
) -> Vec<WitnessPat<'tcx>> {
887+
if column.is_empty() {
888+
return Vec::new();
889+
}
887890
let ty = column[0].ty();
888891
let pcx = &PatCtxt { cx, ty, span: DUMMY_SP, is_top_level: false };
889892

tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.rs

+7
Original file line numberDiff line numberDiff line change
@@ -251,3 +251,10 @@ fn main() {
251251
pub fn takes_non_exhaustive(_: NonExhaustiveEnum) {
252252
let _closure = |_: NonExhaustiveEnum| {};
253253
}
254+
255+
// ICE #117033
256+
enum Void {}
257+
#[deny(non_exhaustive_omitted_patterns)]
258+
pub fn void(v: Void) -> ! {
259+
match v {}
260+
}

0 commit comments

Comments
 (0)