Add diagnostic for break outside of loop

This commit is contained in:
Florian Diebold 2020-05-08 19:48:03 +02:00
parent f8bf94a4b9
commit d0129c4ddb
4 changed files with 62 additions and 1 deletions

View file

@ -518,3 +518,21 @@ fn missing_record_pat_field_no_diagnostic_if_not_exhaustive() {
assert_snapshot!(diagnostics, @"");
}
#[test]
fn break_outside_of_loop() {
let diagnostics = TestDB::with_files(
r"
//- /lib.rs
fn foo() {
break;
}
",
)
.diagnostics()
.0;
assert_snapshot!(diagnostics, @r###""break": break outside of loop
"###
);
}