rust/tests/ui/consts/control-flow/try.rs

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

11 lines
238 B
Rust
Raw Normal View History

// 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`
None
}
fn main() {}