diff options
Diffstat (limited to 'tests/ui/consts/control-flow/short-circuit.rs')
-rw-r--r-- | tests/ui/consts/control-flow/short-circuit.rs | 12 |
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 000000000..6abe10785 --- /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); +} |