diff options
author | Florian Diebold <[email protected]> | 2020-05-08 18:48:03 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2020-05-08 18:48:03 +0100 |
commit | d0129c4ddba3b72e7b26e94e9c25546d37dbf166 (patch) | |
tree | 465c1af378252ce1fea0f47e30f69892332761a0 /crates/ra_hir_ty/src/infer | |
parent | f8bf94a4b94074eb344e495dfb4dab4bec6bc20e (diff) |
Add diagnostic for break outside of loop
Diffstat (limited to 'crates/ra_hir_ty/src/infer')
-rw-r--r-- | crates/ra_hir_ty/src/infer/expr.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/infer/expr.rs b/crates/ra_hir_ty/src/infer/expr.rs index 9cac0c787..0b67d216a 100644 --- a/crates/ra_hir_ty/src/infer/expr.rs +++ b/crates/ra_hir_ty/src/infer/expr.rs | |||
@@ -235,6 +235,10 @@ impl<'a> InferenceContext<'a> { | |||
235 | } | 235 | } |
236 | if let Some(ctxt) = self.breakables.last_mut() { | 236 | if let Some(ctxt) = self.breakables.last_mut() { |
237 | ctxt.may_break = true; | 237 | ctxt.may_break = true; |
238 | } else { | ||
239 | self.push_diagnostic(InferenceDiagnostic::BreakOutsideOfLoop { | ||
240 | expr: tgt_expr, | ||
241 | }); | ||
238 | } | 242 | } |
239 | Ty::simple(TypeCtor::Never) | 243 | Ty::simple(TypeCtor::Never) |
240 | } | 244 | } |