rust/tests/ui/consts/control-flow/short-circuit.rs
2024-02-16 20:02:50 +00:00

13 lines
257 B
Rust

//@ 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);
}