summaryrefslogtreecommitdiffstats
path: root/src/test/ui/closures/2229_closure_analysis/run_pass/capture_with_wildcard_match.rs
blob: cea02fbe15d34978a16678420693732dceb28c4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// edition:2021
//check-pass

fn test1() {
    let foo : [Vec<u8>; 3] = ["String".into(), "String".into(), "String".into()];
    let c = || {
        match foo { _ => () };
    };
    drop(foo);
    c();
}

fn test2() {
    let foo : Option<[Vec<u8>; 3]> = Some(["String".into(), "String".into(), "String".into()]);
    let c = || {
        match foo {
            Some(_) => 1,
            _ => 2
        };
    };
    c();
}

fn main() {
    test1();
    test2();
}