diff options
Diffstat (limited to 'crates/hir_ty/src/diagnostics/expr.rs')
-rw-r--r-- | crates/hir_ty/src/diagnostics/expr.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crates/hir_ty/src/diagnostics/expr.rs b/crates/hir_ty/src/diagnostics/expr.rs index 0a7e6ee52..44d5f6b22 100644 --- a/crates/hir_ty/src/diagnostics/expr.rs +++ b/crates/hir_ty/src/diagnostics/expr.rs | |||
@@ -357,6 +357,18 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
357 | infer: &infer, | 357 | infer: &infer, |
358 | db, | 358 | db, |
359 | pattern_arena: &pattern_arena, | 359 | pattern_arena: &pattern_arena, |
360 | eprint_panic_context: &|| { | ||
361 | use syntax::AstNode; | ||
362 | if let Ok(scrutinee_sptr) = source_map.expr_syntax(match_expr) { | ||
363 | let root = scrutinee_sptr.file_syntax(db.upcast()); | ||
364 | if let Some(match_ast) = scrutinee_sptr.value.to_node(&root).syntax().parent() { | ||
365 | eprintln!( | ||
366 | "Match checking is about to panic on this expression:\n{}", | ||
367 | match_ast.to_string(), | ||
368 | ); | ||
369 | } | ||
370 | } | ||
371 | }, | ||
360 | }; | 372 | }; |
361 | let report = compute_match_usefulness(&cx, &m_arms); | 373 | let report = compute_match_usefulness(&cx, &m_arms); |
362 | 374 | ||