mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Add diagnostic for break outside of loop
This commit is contained in:
parent
f8bf94a4b9
commit
d0129c4ddb
4 changed files with 62 additions and 1 deletions
|
@ -235,6 +235,10 @@ impl<'a> InferenceContext<'a> {
|
|||
}
|
||||
if let Some(ctxt) = self.breakables.last_mut() {
|
||||
ctxt.may_break = true;
|
||||
} else {
|
||||
self.push_diagnostic(InferenceDiagnostic::BreakOutsideOfLoop {
|
||||
expr: tgt_expr,
|
||||
});
|
||||
}
|
||||
Ty::simple(TypeCtor::Never)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue