rust/tests/ui/did_you_mean/issue-54109-and_instead_of_ampersands.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

58 lines
1.1 KiB
Rust
Raw Normal View History

2019-12-03 03:19:58 -06:00
fn main() {}
2018-09-13 07:54:25 -05:00
fn test_and() {
let a = true;
let b = false;
2019-12-03 03:19:58 -06:00
let _ = a and b; //~ ERROR `and` is not a logical operator
if a and b { //~ ERROR `and` is not a logical operator
2018-09-13 07:54:25 -05:00
println!("both");
}
2019-12-03 03:19:58 -06:00
let _recovery_witness: () = 0; //~ ERROR mismatched types
2018-09-13 07:54:25 -05:00
}
fn test_or() {
let a = true;
let b = false;
2019-12-03 03:19:58 -06:00
let _ = a or b; //~ ERROR `or` is not a logical operator
if a or b { //~ ERROR `or` is not a logical operator
2018-09-13 07:54:25 -05:00
println!("both");
}
}
fn test_and_par() {
let a = true;
let b = false;
2019-12-03 03:19:58 -06:00
if (a and b) { //~ ERROR `and` is not a logical operator
2018-09-13 07:54:25 -05:00
println!("both");
}
}
fn test_or_par() {
let a = true;
let b = false;
2019-12-03 03:19:58 -06:00
if (a or b) { //~ ERROR `or` is not a logical operator
2018-09-13 07:54:25 -05:00
println!("both");
}
}
2018-09-13 12:51:29 -05:00
fn test_while_and() {
let a = true;
let b = false;
2019-12-03 03:19:58 -06:00
while a and b { //~ ERROR `and` is not a logical operator
2018-09-13 12:51:29 -05:00
println!("both");
}
}
fn test_while_or() {
let a = true;
let b = false;
2019-12-03 03:19:58 -06:00
while a or b { //~ ERROR `or` is not a logical operator
2018-09-13 12:51:29 -05:00
println!("both");
}
}