about summary refs log tree commit diff
path: root/tests/ui/consts/control-flow/short-circuit.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/consts/control-flow/short-circuit.rs')
-rw-r--r--tests/ui/consts/control-flow/short-circuit.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/ui/consts/control-flow/short-circuit.rs b/tests/ui/consts/control-flow/short-circuit.rs
new file mode 100644
index 00000000000..6abe107855f
--- /dev/null
+++ b/tests/ui/consts/control-flow/short-circuit.rs
@@ -0,0 +1,12 @@
+// run-pass
+
+// Test that both `&&` and `||` actually short-circuit.
+// Formerly, both sides were evaluated unconditionally
+
+const TRUE: bool = true || panic!();
+const FALSE: bool = false && panic!();
+
+fn main() {
+    assert!(TRUE);
+    assert!(!FALSE);
+}