1 use crate::{Diagnostic, DiagnosticsContext}
;
3 // Diagnostic: break-outside-of-loop
5 // This diagnostic is triggered if the `break` keyword is used outside of a loop.
6 pub(crate) fn break_outside_of_loop(
7 ctx
: &DiagnosticsContext
<'_
>,
8 d
: &hir
::BreakOutsideOfLoop
,
11 "break-outside-of-loop",
12 "break outside of loop",
13 ctx
.sema
.diagnostics_display_range(d
.expr
.clone().map(|it
| it
.into())).range
,
19 use crate::tests
::check_diagnostics
;
22 fn break_outside_of_loop() {
26 //^^^^^ error: break outside of loop