summaryrefslogtreecommitdiffstats
path: root/tests/ui/let-else/let-else-then-diverge.rs
blob: 1a75310c94ff58c51f2e1f9e2fe2c9e437aff29a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// popped up in #94012, where an alternative desugaring was
// causing unreachable code errors

#![deny(unused_variables)]
#![deny(unreachable_code)]

fn let_else_diverge() -> bool {
    let Some(_) = Some("test") else {
        let x = 5; //~ ERROR unused variable: `x`
        return false;
    };
    return true;
}

fn main() {
    let_else_diverge();
}