]> git.lizzy.rs Git - rust.git/commitdiff
Add "while" tests for issue 54109
authorVitaly _Vi Shukela <vi0oss@gmail.com>
Thu, 13 Sep 2018 17:51:29 +0000 (20:51 +0300)
committerVitaly _Vi Shukela <vi0oss@gmail.com>
Thu, 13 Sep 2018 17:51:29 +0000 (20:51 +0300)
src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.rs
src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr

index cb37845529407e9c85da79c553d7da053cae5985..d053b11772cd005933d2fbb10e3d3c27a7ccaff7 100644 (file)
@@ -44,5 +44,23 @@ fn test_or_par() {
     }
 }
 
+fn test_while_and() {
+    let a = true;
+    let b = false;
+    while a and b {
+        //~^ ERROR expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `and`
+        println!("both");
+    }
+}
+
+fn test_while_or() {
+    let a = true;
+    let b = false;
+    while a or b {
+        //~^ ERROR expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `or`
+        println!("both");
+    }
+}
+
 fn main() {
 }
index 74ebb1e757c96158f7285a4d995da52221f07dd7..552619dd4beecfcfc4d2d79a426cb6e57e411f49 100644 (file)
@@ -32,4 +32,23 @@ LL |     if (a or b) {
    |           expected one of 8 possible tokens here
    |           help: use `||` instead of `or` for the boolean operator: `||`
 
-error: aborting due to 4 previous errors
+error: expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `and`
+  --> $DIR/issue-54109-and_instead_of_ampersands.rs:50:13
+   |
+LL |     while a and b {
+   |             ^^^
+   |             |
+   |             expected one of `!`, `.`, `::`, `?`, `{`, or an operator here
+   |             help: use `&&` instead of `and` for the boolean operator: `&&`
+
+error: expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `or`
+  --> $DIR/issue-54109-and_instead_of_ampersands.rs:59:13
+   |
+LL |     while a or b {
+   |             ^^
+   |             |
+   |             expected one of `!`, `.`, `::`, `?`, `{`, or an operator here
+   |             help: use `||` instead of `or` for the boolean operator: `||`
+
+error: aborting due to 6 previous errors
+