rust/tests/ui/let-else/const-fn.rs

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

19 lines
242 B
Rust
Raw Normal View History

2022-09-17 23:18:34 -05:00
// 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);
}