summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/control-flow/short-circuit.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/consts/control-flow/short-circuit.rs')
-rw-r--r--src/test/ui/consts/control-flow/short-circuit.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/ui/consts/control-flow/short-circuit.rs b/src/test/ui/consts/control-flow/short-circuit.rs
new file mode 100644
index 000000000..6abe10785
--- /dev/null
+++ b/src/test/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);
+}