2024-02-16 14:02:50 -06:00
|
|
|
//@ run-pass
|
2019-11-17 23:11:42 -06:00
|
|
|
|
2020-05-21 14:49:38 -05:00
|
|
|
// Test that both `&&` and `||` actually short-circuit.
|
|
|
|
// Formerly, both sides were evaluated unconditionally
|
2019-11-17 23:11:42 -06:00
|
|
|
|
2020-05-21 14:49:38 -05:00
|
|
|
const TRUE: bool = true || panic!();
|
|
|
|
const FALSE: bool = false && panic!();
|
2019-11-17 23:11:42 -06:00
|
|
|
|
2020-05-21 14:49:38 -05:00
|
|
|
fn main() {
|
|
|
|
assert!(TRUE);
|
|
|
|
assert!(!FALSE);
|
|
|
|
}
|