1 use std::{
2     future::Future,
3     pin::Pin,
4     task::{Context, Poll},
5 };
6 
7 struct Sleep;
8 
9 impl Future for Sleep {
10     type Output = ();
11 
poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>12     fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
13         Poll::Ready(())
14     }
15 }
16 
17 impl Drop for Sleep {
drop(&mut self)18     fn drop(&mut self) {}
19 }
20 
sleep() -> Sleep21 fn sleep() -> Sleep {
22     Sleep
23 }
24 
25 
26 struct MyFuture {
27     sleep: Sleep,
28 }
29 
30 impl MyFuture {
new() -> Self31     fn new() -> Self {
32         Self {
33             sleep: sleep(),
34         }
35     }
36 }
37 
38 impl Future for MyFuture {
39     type Output = ();
40 
poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>41     fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
42         self.sleep.poll(cx)
43         //~^ ERROR no method named `poll` found for struct `Sleep` in the current scope
44     }
45 }
46 
main()47 fn main() {}
48