summary refs log tree commit diff
path: root/tests/ui/consts/control-flow/try.rs
blob: 5c6957df4056649d3bd8d44e387b62dcc941c4e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
// The `?` operator is still not const-evaluatable because it calls `From::from` on the error
// variant.

const fn opt() -> Option<i32> {
    let x = Some(2);
    x?; //~ ERROR `?` is not allowed in a `const fn`
    //~^ ERROR: cannot convert
    //~| ERROR: cannot determine
    None
}

fn main() {}