]> git.lizzy.rs Git - rust.git/blob - tests/ui/async-await/issue-67252-unnamed-future.rs
Auto merge of #107843 - bjorn3:sync_cg_clif-2023-02-09, r=bjorn3
[rust.git] / tests / ui / async-await / issue-67252-unnamed-future.rs
1 // revisions: no_drop_tracking drop_tracking drop_tracking_mir
2 // [drop_tracking] compile-flags: -Zdrop-tracking
3 // [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
4 // edition:2018
5 use std::future::Future;
6 use std::pin::Pin;
7 use std::task::{Context, Poll};
8
9 fn spawn<T: Send>(_: T) {}
10
11 pub struct AFuture;
12 impl Future for AFuture{
13     type Output = ();
14
15     fn poll(mut self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<()> {
16         unimplemented!()
17     }
18 }
19
20 async fn foo() {
21     spawn(async { //~ ERROR future cannot be sent between threads safely
22         let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
23         AFuture.await;
24         drop(a);
25     });
26 }
27
28 fn main() {}