rust/tests/ui/lazy-and-or.rs

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

13 lines
310 B
Rust
Raw Normal View History

// run-pass
fn incr(x: &mut isize) -> bool { *x += 1; assert!((false)); return false; }
2010-06-24 12:03:09 +08:00
pub fn main() {
2015-01-26 05:05:03 +08:00
let x = 1 == 2 || 3 == 3;
2013-03-29 09:39:09 +08:00
assert!((x));
let mut y: isize = 10;
2014-10-15 09:07:11 +08:00
println!("{}", x || incr(&mut y));
assert_eq!(y, 10);
2013-03-29 09:39:09 +08:00
if true && x { assert!((true)); } else { assert!((false)); }
}