Add "while" tests for issue 54109
This commit is contained in:
parent
acc44e40cc
commit
79919a7ed6
@ -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() {
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user