From 79919a7ed672fc77d0c6b8e5836b33af4598e280 Mon Sep 17 00:00:00 2001 From: Vitaly _Vi Shukela Date: Thu, 13 Sep 2018 20:51:29 +0300 Subject: [PATCH] Add "while" tests for issue 54109 --- .../issue-54109-and_instead_of_ampersands.rs | 18 ++++++++++++++++ ...sue-54109-and_instead_of_ampersands.stderr | 21 ++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.rs b/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.rs index cb378455294..d053b11772c 100644 --- a/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.rs +++ b/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.rs @@ -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() { } diff --git a/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr b/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr index 74ebb1e757c..552619dd4be 100644 --- a/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr +++ b/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr @@ -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 +