]> git.lizzy.rs Git - rust.git/blob - tests/ui/async-await/issues/issue-64477.rs
Rollup merge of #106944 - Nilstrieb:there-once-was-a-diagnostic, r=WaffleLapkin
[rust.git] / tests / ui / async-await / issues / issue-64477.rs
1 // Regression test for #64477.
2 //
3 // We were incorrectly claiming that the `f(x).await` future captured
4 // a value of type `T`, and hence that `T: Send` would have to hold.
5 //
6 // check-pass
7 // edition:2018
8
9 use std::future::Future;
10 use std::pin::Pin;
11
12 fn f<T>(_: &T) -> Pin<Box<dyn Future<Output = ()> + Send>> {
13     unimplemented!()
14 }
15
16 pub fn g<T: Sync>(x: &'static T) -> impl Future<Output = ()> + Send {
17     async move { f(x).await }
18 }
19
20 fn main() { }