diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-06-03 10:55:37 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-03 10:55:37 +0100 |
commit | 50936397cc4e34712b18cd337facef527fa20b48 (patch) | |
tree | 709dac4e04b492c16829e299bbaf6f2377f0f3a0 /crates/hir_ty/src/diagnostics/expr.rs | |
parent | e8e14e1b13b76aaa643bc3beffb9c52bc5228d24 (diff) | |
parent | 0a8c30a96fe09047da07a8e2980baa47a334a3d7 (diff) |
Merge #9105
9105: internal: calculate pattern adjustments r=flodiebold a=iDawer
This extends `InferenceResult` with `pub pat_adjustments: FxHashMap<PatId, Vec<Ty>>`.
Fixes #9095
Co-authored-by: Dawer <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/diagnostics/expr.rs')
-rw-r--r-- | crates/hir_ty/src/diagnostics/expr.rs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/crates/hir_ty/src/diagnostics/expr.rs b/crates/hir_ty/src/diagnostics/expr.rs index 3efbce773..a2a4d61db 100644 --- a/crates/hir_ty/src/diagnostics/expr.rs +++ b/crates/hir_ty/src/diagnostics/expr.rs | |||
@@ -357,17 +357,20 @@ 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: &|| { | 360 | panic_context: &|| { |
361 | use syntax::AstNode; | 361 | use syntax::AstNode; |
362 | if let Ok(scrutinee_sptr) = source_map.expr_syntax(match_expr) { | 362 | let match_expr_text = source_map |
363 | let root = scrutinee_sptr.file_syntax(db.upcast()); | 363 | .expr_syntax(match_expr) |
364 | if let Some(match_ast) = scrutinee_sptr.value.to_node(&root).syntax().parent() { | 364 | .ok() |
365 | eprintln!( | 365 | .and_then(|scrutinee_sptr| { |
366 | "Match checking is about to panic on this expression:\n{}", | 366 | let root = scrutinee_sptr.file_syntax(db.upcast()); |
367 | match_ast.to_string(), | 367 | scrutinee_sptr.value.to_node(&root).syntax().parent() |
368 | ); | 368 | }) |
369 | } | 369 | .map(|node| node.to_string()); |
370 | } | 370 | format!( |
371 | "expression:\n{}", | ||
372 | match_expr_text.as_deref().unwrap_or("<synthesized expr>") | ||
373 | ) | ||
371 | }, | 374 | }, |
372 | }; | 375 | }; |
373 | let report = compute_match_usefulness(&cx, &m_arms); | 376 | let report = compute_match_usefulness(&cx, &m_arms); |