about summary refs log tree commit diff
path: root/src/librustc_error_codes
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-04-22 17:52:21 +0000
committerbors <bors@rust-lang.org>2020-04-22 17:52:21 +0000
commitb2e36e6c2d229126b59e892c9147fbb68115d292 (patch)
tree19503bd32ce13ba6ec09ad004898782b0bc0d0dd /src/librustc_error_codes
parent82e90d64266b8a4b53935d629786e69610b33f25 (diff)
parent238e8228d4f78425231113b8a8368abd0d01e9a7 (diff)
downloadrust-b2e36e6c2d229126b59e892c9147fbb68115d292.tar.gz
rust-b2e36e6c2d229126b59e892c9147fbb68115d292.zip
Auto merge of #71431 - Dylan-DPC:rollup-rvm6tfy, r=Dylan-DPC
Rollup of 4 pull requests

Successful merges:

 - #71280 (Miri: mplace_access_checked: offer option to force different alignment on place)
 - #71336 (Exhaustively match on `{Statement,Terminator}Kind` during const checking)
 - #71370 (Added detailed error code explanation for issue E0696 in Rust compiler.)
 - #71401 (visit_place_base is just visit_local)

Failed merges:

r? @ghost
Diffstat (limited to 'src/librustc_error_codes')
-rw-r--r--src/librustc_error_codes/error_codes.rs2
-rw-r--r--src/librustc_error_codes/error_codes/E0696.md49
2 files changed, 50 insertions, 1 deletions
diff --git a/src/librustc_error_codes/error_codes.rs b/src/librustc_error_codes/error_codes.rs
index 9f4b5fd85fd..bf4a6c52ab8 100644
--- a/src/librustc_error_codes/error_codes.rs
+++ b/src/librustc_error_codes/error_codes.rs
@@ -386,6 +386,7 @@ E0691: include_str!("./error_codes/E0691.md"),
 E0692: include_str!("./error_codes/E0692.md"),
 E0693: include_str!("./error_codes/E0693.md"),
 E0695: include_str!("./error_codes/E0695.md"),
+E0696: include_str!("./error_codes/E0696.md"),
 E0697: include_str!("./error_codes/E0697.md"),
 E0698: include_str!("./error_codes/E0698.md"),
 E0699: include_str!("./error_codes/E0699.md"),
@@ -604,7 +605,6 @@ E0753: include_str!("./error_codes/E0753.md"),
     E0687, // in-band lifetimes cannot be used in `fn`/`Fn` syntax
     E0688, // in-band lifetimes cannot be mixed with explicit lifetime binders
 //  E0694, // an unknown tool name found in scoped attributes
-    E0696, // `continue` pointing to a labeled block
 //  E0702, // replaced with a generic attribute input check
 //  E0707, // multiple elided lifetimes used in arguments of `async fn`
 //  E0709, // multiple different lifetimes used in arguments of `async fn`
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!
+        }
+    }
+}
+```