Rollup merge of #117034 - Nadrieril:fix-117033, r=cjgillot
Don't crash on empty match in the `nonexhaustive_omitted_patterns` lint Oops Fixes https://github.com/rust-lang/rust/issues/117033
This commit is contained in:
commit
4681eb6c94
@ -884,6 +884,9 @@ fn collect_nonexhaustive_missing_variants<'p, 'tcx>(
|
|||||||
cx: &MatchCheckCtxt<'p, 'tcx>,
|
cx: &MatchCheckCtxt<'p, 'tcx>,
|
||||||
column: &[&DeconstructedPat<'p, 'tcx>],
|
column: &[&DeconstructedPat<'p, 'tcx>],
|
||||||
) -> Vec<WitnessPat<'tcx>> {
|
) -> Vec<WitnessPat<'tcx>> {
|
||||||
|
if column.is_empty() {
|
||||||
|
return Vec::new();
|
||||||
|
}
|
||||||
let ty = column[0].ty();
|
let ty = column[0].ty();
|
||||||
let pcx = &PatCtxt { cx, ty, span: DUMMY_SP, is_top_level: false };
|
let pcx = &PatCtxt { cx, ty, span: DUMMY_SP, is_top_level: false };
|
||||||
|
|
||||||
|
@ -251,3 +251,10 @@ fn main() {
|
|||||||
pub fn takes_non_exhaustive(_: NonExhaustiveEnum) {
|
pub fn takes_non_exhaustive(_: NonExhaustiveEnum) {
|
||||||
let _closure = |_: NonExhaustiveEnum| {};
|
let _closure = |_: NonExhaustiveEnum| {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ICE #117033
|
||||||
|
enum Void {}
|
||||||
|
#[deny(non_exhaustive_omitted_patterns)]
|
||||||
|
pub fn void(v: Void) -> ! {
|
||||||
|
match v {}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user