summaryrefslogtreecommitdiffstats
path: root/src/test/ui/lazy-and-or.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/lazy-and-or.rs')
-rw-r--r--src/test/ui/lazy-and-or.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/ui/lazy-and-or.rs b/src/test/ui/lazy-and-or.rs
new file mode 100644
index 000000000..0b44a70a5
--- /dev/null
+++ b/src/test/ui/lazy-and-or.rs
@@ -0,0 +1,12 @@
+// run-pass
+
+fn incr(x: &mut isize) -> bool { *x += 1; assert!((false)); return false; }
+
+pub fn main() {
+ let x = 1 == 2 || 3 == 3;
+ assert!((x));
+ let mut y: isize = 10;
+ println!("{}", x || incr(&mut y));
+ assert_eq!(y, 10);
+ if true && x { assert!((true)); } else { assert!((false)); }
+}