aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/diagnostics/expr.rs
diff options
context:
space:
mode:
authorDawer <[email protected]>2021-05-19 14:00:25 +0100
committerDawer <[email protected]>2021-05-31 20:49:44 +0100
commite16f413582ea45d6b318337ea2c7838fdc3b82a4 (patch)
tree2fbd3e339ca0d5d3f05e1d5888e5c530e7c207c7 /crates/hir_ty/src/diagnostics/expr.rs
parentf571b62a13aff662c9d1c17206342479f8529633 (diff)
eprint panic context
Diffstat (limited to 'crates/hir_ty/src/diagnostics/expr.rs')
-rw-r--r--crates/hir_ty/src/diagnostics/expr.rs12
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