2023-04-03 13:29:41 -05:00
|
|
|
//@ check-pass
|
|
|
|
//@ edition:2018
|
|
|
|
|
2023-09-18 10:18:51 -05:00
|
|
|
#![feature(if_let_guard)]
|
|
|
|
|
2023-04-03 13:29:41 -05:00
|
|
|
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) => {}
|
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
}
|
2023-09-18 10:18:51 -05:00
|
|
|
|
|
|
|
async fn if_let() {
|
|
|
|
match Some(StructB {}) {
|
|
|
|
Some(struct_b) if let true = get_struct_a_async().await.fn_taking_struct_b(&struct_b) => {}
|
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
}
|