summaryrefslogtreecommitdiffstats
path: root/tests/ui/async-await/missed-capture-issue-107414.rs
blob: bb14eb74b3a510526a7e07535539f3bf5284b41b (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
28
29
30
31
32
33
// check-pass
// edition:2018

#![feature(if_let_guard)]

fn main() {}

struct StructA {}
struct StructB {}

impl StructA {
    fn fn_taking_struct_b(&self, struct_b: &StructB) -> bool {
        true
    }
}

async fn get_struct_a_async() -> StructA {
    StructA {}
}

async fn ice() {
    match Some(StructB {}) {
        Some(struct_b) if get_struct_a_async().await.fn_taking_struct_b(&struct_b) => {}
        _ => {}
    }
}

async fn if_let() {
    match Some(StructB {}) {
        Some(struct_b) if let true = get_struct_a_async().await.fn_taking_struct_b(&struct_b) => {}
        _ => {}
    }
}