rust/tests/ui/rfc-2497-if-let-chains/protect-precedences.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
391 B
Rust
Raw Normal View History

// run-pass
#![allow(irrefutable_let_patterns)]
fn main() {
let x: bool;
// This should associate as: `(x = (true && false));`.
x = true && false;
assert!(!x);
fn _f1() -> bool {
// Should associate as `(let _ = (return (true && false)))`.
2021-08-08 14:49:13 +00:00
if let _ = return true && false {};
//~^ WARNING unreachable block in `if`
}
assert!(!_f1());
}