From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/label/label_break_value_continue.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/ui/label/label_break_value_continue.rs (limited to 'tests/ui/label/label_break_value_continue.rs') diff --git a/tests/ui/label/label_break_value_continue.rs b/tests/ui/label/label_break_value_continue.rs new file mode 100644 index 000000000..22172f4fd --- /dev/null +++ b/tests/ui/label/label_break_value_continue.rs @@ -0,0 +1,26 @@ +#![allow(unused_labels)] + +// Simple continue pointing to an unlabeled break should yield in an error +fn continue_simple() { + 'b: { + continue; //~ ERROR unlabeled `continue` inside of a labeled block + } +} + +// Labeled continue pointing to an unlabeled break should yield in an error +fn continue_labeled() { + 'b: { + continue 'b; //~ ERROR `continue` pointing to a labeled block + } +} + +// Simple continue that would cross a labeled block should yield in an error +fn continue_crossing() { + loop { + 'b: { + continue; //~ ERROR unlabeled `continue` inside of a labeled block + } + } +} + +pub fn main() {} -- cgit v1.2.3