Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Sleep documentation for !Unpin #3330

Closed
wants to merge 1 commit into from
Closed

Conversation

Darksonn
Copy link
Contributor

Currently the documentation for Sleep renders like this:

scr
scr

It is not exactly clear from this documentation that Sleep is !Unpin. This PR manually implements the project method on Sleep so that the documentation is improved to this:

scr
scr

I will let it be up to the rest of the team to decide if this is worth the extra unsafe block.

@Darksonn Darksonn added T-docs Topic: documentation A-tokio Area: The main tokio crate M-time Module: tokio/time labels Dec 24, 2020
Copy link
Member

@taiki-e taiki-e left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend adding a document explaining that this future is !Unpin, instead of adding unsafe code.

@quasicomputational
Copy link

+1 for documenting this and giving explicit instructions on how to pin Sleep. I just got as far as writing a bug report for the loss of a usable Unpin impl between 0.3.6 and 1.0.0, and only realised it was intentional when I was looking for the commit that 'broke' it and realised it was deliberate.

@jyn514
Copy link
Contributor

jyn514 commented Dec 29, 2020

@Darksonn would it help if rustdoc could tell that __Origin: Unpin is always false and stop showing the blanket impl if so?

@Darksonn
Copy link
Contributor Author

Yes, that would solve the problem.

@Darksonn
Copy link
Contributor Author

Closing in favor of #3457.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-time Module: tokio/time T-docs Topic: documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants