From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/async-await/issue-69446-fnmut-capture.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/ui/async-await/issue-69446-fnmut-capture.rs (limited to 'tests/ui/async-await/issue-69446-fnmut-capture.rs') diff --git a/tests/ui/async-await/issue-69446-fnmut-capture.rs b/tests/ui/async-await/issue-69446-fnmut-capture.rs new file mode 100644 index 000000000..842115538 --- /dev/null +++ b/tests/ui/async-await/issue-69446-fnmut-capture.rs @@ -0,0 +1,22 @@ +// Regression test for issue #69446 - we should display +// which variable is captured +// edition:2018 + +use core::future::Future; + +struct Foo; +impl Foo { + fn foo(&mut self) {} +} + +async fn bar(_: impl FnMut() -> T) +where + T: Future, +{} + +fn main() { + let mut x = Foo; + bar(move || async { //~ ERROR captured + x.foo(); + }); +} -- cgit v1.2.3