mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-18 18:58:45 +00:00
Auto merge of #7021 - camsteffen:7012, r=giraffate
Fix ICE #7012 changelog: none Fixes #7012
This commit is contained in:
commit
a15d987c8f
2 changed files with 25 additions and 6 deletions
|
@ -1046,16 +1046,18 @@ fn check_wild_enum_match(cx: &LateContext<'_>, ex: &Expr<'_>, arms: &[Arm<'_>])
|
|||
path
|
||||
},
|
||||
PatKind::TupleStruct(path, patterns, ..) => {
|
||||
if arm.guard.is_none() && patterns.iter().all(|p| !is_refutable(cx, p)) {
|
||||
let id = cx.qpath_res(path, pat.hir_id).def_id();
|
||||
missing_variants.retain(|e| e.ctor_def_id != Some(id));
|
||||
if let Some(id) = cx.qpath_res(path, pat.hir_id).opt_def_id() {
|
||||
if arm.guard.is_none() && patterns.iter().all(|p| !is_refutable(cx, p)) {
|
||||
missing_variants.retain(|e| e.ctor_def_id != Some(id));
|
||||
}
|
||||
}
|
||||
path
|
||||
},
|
||||
PatKind::Struct(path, patterns, ..) => {
|
||||
if arm.guard.is_none() && patterns.iter().all(|p| !is_refutable(cx, p.pat)) {
|
||||
let id = cx.qpath_res(path, pat.hir_id).def_id();
|
||||
missing_variants.retain(|e| e.def_id != id);
|
||||
if let Some(id) = cx.qpath_res(path, pat.hir_id).opt_def_id() {
|
||||
if arm.guard.is_none() && patterns.iter().all(|p| !is_refutable(cx, p.pat)) {
|
||||
missing_variants.retain(|e| e.def_id != id);
|
||||
}
|
||||
}
|
||||
path
|
||||
},
|
||||
|
|
17
tests/ui/crashes/ice-7012.rs
Normal file
17
tests/ui/crashes/ice-7012.rs
Normal file
|
@ -0,0 +1,17 @@
|
|||
#![allow(clippy::all)]
|
||||
|
||||
enum _MyOption {
|
||||
None,
|
||||
Some(()),
|
||||
}
|
||||
|
||||
impl _MyOption {
|
||||
fn _foo(&self) {
|
||||
match self {
|
||||
&Self::Some(_) => {},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
Loading…
Reference in a new issue