From 9e579cc10c32945cdde6fa1fb474005d31b8c2cf Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Mon, 3 Apr 2023 20:29:41 +0200 Subject: [PATCH] Add test --- .../missed-capture-issue-107414.rs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/ui/async-await/missed-capture-issue-107414.rs diff --git a/tests/ui/async-await/missed-capture-issue-107414.rs b/tests/ui/async-await/missed-capture-issue-107414.rs new file mode 100644 index 00000000000..0ab4f5ade98 --- /dev/null +++ b/tests/ui/async-await/missed-capture-issue-107414.rs @@ -0,0 +1,24 @@ +// check-pass +// edition:2018 + +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) => {} + _ => {} + } +}