From 344cf1db5fed792d99d4736fbc785bea35f64ba9 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Mon, 21 Mar 2022 17:00:03 +0100 Subject: [PATCH] Fix expect --- crates/hir/src/lib.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index ba7922ef3d..f4e58d88ed 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -1188,8 +1188,10 @@ impl DefWithBody { } } for (expr, mismatch) in infer.expr_type_mismatches() { - let expr = - source_map.expr_syntax(expr).expect("break outside of loop in synthetic syntax"); + let expr = match source_map.expr_syntax(expr) { + Ok(expr) => expr, + Err(SyntheticSyntax) => continue, + }; acc.push( TypeMismatch { expr,