about summary refs log tree commit diff
path: root/src/librustc_error_codes/error_codes
diff options
context:
space:
mode:
authorpankajchaudhary5 <pankajchaudhary172@gmail.com>2020-04-21 09:24:16 +0530
committerpankajchaudhary5 <pankajchaudhary172@gmail.com>2020-04-21 20:09:07 +0530
commite5b68bc7193889a5df85ea4ffba84ce20c1f0471 (patch)
tree2ee5f0bd130808ba05672fc4caab6aad8860fb51 /src/librustc_error_codes/error_codes
parent20fc02f836f3035b86b56a7cedb97c5cd4ed9612 (diff)
downloadrust-e5b68bc7193889a5df85ea4ffba84ce20c1f0471.tar.gz
rust-e5b68bc7193889a5df85ea4ffba84ce20c1f0471.zip
Added proper explanation error code E0696
Diffstat (limited to 'src/librustc_error_codes/error_codes')
-rw-r--r--src/librustc_error_codes/error_codes/E0696.md49
1 files changed, 49 insertions, 0 deletions
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!
+        }
+    }
+}
+```