summaryrefslogtreecommitdiffstats
path: root/tests/ui/let-else/const-fn.rs
blob: a3921b8033fc01d3bdd45c79ab2bc1fb7a9f00bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// run-pass
// issue #101932


const fn foo(a: Option<i32>) -> i32 {
    let Some(a) = a else {
        return 42
    };

    a + 1
}

fn main() {
    const A: i32 = foo(None);
    const B: i32 = foo(Some(1));

    println!("{} {}", A, B);
}