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

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 04:03:09 +00:00
pub fn main() {
2015-01-25 21:05:03 +00:00
let x = 1 == 2 || 3 == 3;
2013-03-29 01:39:09 +00:00
assert!((x));
let mut y: isize = 10;
2014-10-15 01:07:11 +00:00
println!("{}", x || incr(&mut y));
assert_eq!(y, 10);
2013-03-29 01:39:09 +00:00
if true && x { assert!((true)); } else { assert!((false)); }
}