{
if (!context->have_loop_context ())
{
- rust_error_at (expr.get_locus (), "cannot %<break%> outside of a loop");
+ rust_error_at (expr.get_locus (), ErrorCode ("E0268"),
+ "%<break%> outside of a loop or labeled block");
return;
}
{
if (!context->have_loop_context ())
{
- rust_error_at (expr.get_locus (),
- "cannot %<continue%> outside of a loop");
+ rust_error_at (expr.get_locus (), ErrorCode ("E0268"),
+ "%<continue%> outside of a loop");
return;
}
--- /dev/null
+// https://doc.rust-lang.org/error_codes/E0268.html
+#![allow(unused)]
+fn boo() {
+ continue; // { dg-error ".continue. outside of a loop" }
+ break; // { dg-error ".break. outside of a loop or labeled block" }
+}
+
+fn main() {
+ boo()
+}