about summary refs log tree commit diff
path: root/tests/ui/lazy-and-or.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/lazy-and-or.rs')
-rw-r--r--tests/ui/lazy-and-or.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/ui/lazy-and-or.rs b/tests/ui/lazy-and-or.rs
new file mode 100644
index 00000000000..0b44a70a569
--- /dev/null
+++ b/tests/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)); }
+}