diff options
Diffstat (limited to 'src/test/ui/async-await/issues/issue-64477.rs')
-rw-r--r-- | src/test/ui/async-await/issues/issue-64477.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/ui/async-await/issues/issue-64477.rs b/src/test/ui/async-await/issues/issue-64477.rs new file mode 100644 index 000000000..5bd52d44a --- /dev/null +++ b/src/test/ui/async-await/issues/issue-64477.rs @@ -0,0 +1,20 @@ +// Regression test for #64477. +// +// We were incorrectly claiming that the `f(x).await` future captured +// a value of type `T`, and hence that `T: Send` would have to hold. +// +// check-pass +// edition:2018 + +use std::future::Future; +use std::pin::Pin; + +fn f<T>(_: &T) -> Pin<Box<dyn Future<Output = ()> + Send>> { + unimplemented!() +} + +pub fn g<T: Sync>(x: &'static T) -> impl Future<Output = ()> + Send { + async move { f(x).await } +} + +fn main() { } |