Skip to content

Commit

Permalink
Fix #117033
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadrieril committed Oct 21, 2023
1 parent 26f340a commit a134f16
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions compiler/rustc_mir_build/src/thir/pattern/usefulness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,9 @@ fn collect_nonexhaustive_missing_variants<'p, 'tcx>(
cx: &MatchCheckCtxt<'p, 'tcx>,
column: &[&DeconstructedPat<'p, 'tcx>],
) -> Vec<WitnessPat<'tcx>> {
if column.is_empty() {
return Vec::new();
}
let ty = column[0].ty();
let pcx = &PatCtxt { cx, ty, span: DUMMY_SP, is_top_level: false };

Expand Down
7 changes: 7 additions & 0 deletions tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,10 @@ fn main() {
pub fn takes_non_exhaustive(_: NonExhaustiveEnum) {
let _closure = |_: NonExhaustiveEnum| {};
}

// ICE #117033
enum Void {}
#[deny(non_exhaustive_omitted_patterns)]
pub fn void(v: Void) -> ! {
match v {}
}

0 comments on commit a134f16

Please sign in to comment.