mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
Fix ICE in question_mark
This commit is contained in:
parent
20e4204730
commit
2255cfd2ab
2 changed files with 10 additions and 2 deletions
|
@ -123,8 +123,8 @@ fn check_if_let_some_or_err_and_early_return<'tcx>(cx: &LateContext<'tcx>, expr:
|
|||
if_chain! {
|
||||
if let Some(higher::IfLet { let_pat, let_expr, if_then, if_else }) = higher::IfLet::hir(cx, expr);
|
||||
if !is_else_clause(cx.tcx, expr);
|
||||
if let PatKind::TupleStruct(ref path1, fields, None) = let_pat.kind;
|
||||
if let PatKind::Binding(annot, bind_id, ident, _) = fields[0].kind;
|
||||
if let PatKind::TupleStruct(ref path1, [field], None) = let_pat.kind;
|
||||
if let PatKind::Binding(annot, bind_id, ident, _) = field.kind;
|
||||
let caller_ty = cx.typeck_results().expr_ty(let_expr);
|
||||
let if_block = IfBlockType::IfLet(path1, caller_ty, ident.name, let_expr, if_then, if_else);
|
||||
if (is_early_return(sym::Option, cx, &if_block) && path_to_local_id(peel_blocks(if_then), bind_id))
|
||||
|
|
8
tests/ui/crashes/ice-9242.rs
Normal file
8
tests/ui/crashes/ice-9242.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
enum E {
|
||||
X(),
|
||||
Y,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let _ = if let E::X() = E::X() { 1 } else { 2 };
|
||||
}
|
Loading…
Reference in a new issue