summary refs log tree commit diff
path: root/src/test/ui/try-on-option-diagnostics.rs
blob: 65d5e29ec2f135c238938eb479a63ee465493692 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#![feature(try_trait)]
// edition:2018
fn main() {}

fn a_function() -> u32 {
    let x: Option<u32> = None;
    x?; //~ ERROR the `?` operator
    22
}

fn a_closure() -> u32 {
    let a_closure = || {
        let x: Option<u32> = None;
        x?; //~ ERROR the `?` operator
        22
    };
    a_closure()
}