From e5b68bc7193889a5df85ea4ffba84ce20c1f0471 Mon Sep 17 00:00:00 2001 From: pankajchaudhary5 Date: Tue, 21 Apr 2020 09:24:16 +0530 Subject: Added proper explanation error code E0696 --- src/librustc_error_codes/error_codes/E0696.md | 49 +++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/librustc_error_codes/error_codes/E0696.md (limited to 'src/librustc_error_codes/error_codes') diff --git a/src/librustc_error_codes/error_codes/E0696.md b/src/librustc_error_codes/error_codes/E0696.md new file mode 100644 index 00000000000..fc32d1cc5f7 --- /dev/null +++ b/src/librustc_error_codes/error_codes/E0696.md @@ -0,0 +1,49 @@ +A function is using `continue` keyword incorrectly. + +Erroneous code example: + +```compile_fail,E0696 +fn continue_simple() { + 'b: { + continue; // error! + } +} +fn continue_labeled() { + 'b: { + continue 'b; // error! + } +} +fn continue_crossing() { + loop { + 'b: { + continue; // error! + } + } +} +``` + +Here we have used the `continue` keyword incorrectly. As we +have seen above that `continue` pointing to a labeled block. + +To fix this we have to use the labeled block properly. +For example: + +``` +fn continue_simple() { + 'b: loop { + continue ; // ok! + } +} +fn continue_labeled() { + 'b: loop { + continue 'b; // ok! + } +} +fn continue_crossing() { + loop { + 'b: loop { + continue; // ok! + } + } +} +``` -- cgit 1.4.1-3-g733a5