summaryrefslogtreecommitdiffstats
path: root/tests/ui/rfc-2497-if-let-chains/protect-precedences.rs
blob: fcc09b159ec23a255e1fd5de548ebc5a3c966552 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// 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)))`.
        if let _ = return true && false {};
        //~^ WARNING unreachable block in `if`
    }
    assert!(!_f1());
}