about summary refs log tree commit diff
path: root/src/librustc_error_codes/error_codes
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-04-22 16:41:12 +0200
committerGitHub <noreply@github.com>2020-04-22 16:41:12 +0200
commit7939a4d728aff0bca3cd75515fc60f537e5d9ec6 (patch)
tree9eb710491eb180de40a71d145998ba99a4288a09 /src/librustc_error_codes/error_codes
parent221f677d70809bef43e22b689e41de88b31080f4 (diff)
parente5b68bc7193889a5df85ea4ffba84ce20c1f0471 (diff)
downloadrust-7939a4d728aff0bca3cd75515fc60f537e5d9ec6.tar.gz
rust-7939a4d728aff0bca3cd75515fc60f537e5d9ec6.zip
Rollup merge of #71370 - PankajChaudhary5:ErrorCode-E0696, r=GuillaumeGomez
Added detailed error code explanation for issue E0696 in Rust compiler.

Added proper error explanation for issue E0696 in the Rust compiler.
Error Code E0696

Sub Part of Issue #61137

r? @GuillaumeGomez
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!
+        }
+    }
+}
+```