diff options
Diffstat (limited to 'tests/ui/async-await/issue-69446-fnmut-capture.rs')
| -rw-r--r-- | tests/ui/async-await/issue-69446-fnmut-capture.rs | 22 |
1 files changed, 22 insertions, 0 deletions
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 00000000000..842115538c9 --- /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<T>(_: impl FnMut() -> T) +where + T: Future<Output = ()>, +{} + +fn main() { + let mut x = Foo; + bar(move || async { //~ ERROR captured + x.foo(); + }); +} |
