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

time: report correct error for timers that exceed max duration #2023

Merged
merged 3 commits into from
Jul 25, 2020

Conversation

benesch
Copy link
Contributor

@benesch benesch commented Dec 24, 2019

A fix for #1953, as discussed with @carllerche on Discord. The first commit is a surgical fix that fixes the error message with as few code changes as possible. The second commit is a more expansive refactoring that avoids the duplicate validation introduced in the first commit— and also ensures that the "at capacity" error is propagated correctly.

Let me know if you'd like me to squash the commits together, or drop the second commit entirely!

@benesch benesch force-pushed the time-error branch 2 times, most recently from 0afa434 to ae483e5 Compare December 24, 2019 16:04
@carllerche
Copy link
Member

Unfortunately, cargo fmt has a bug, so you need to use something like the following to fmt:

rustfmt --check --edition 2018 $(find . -name '*.rs' -print)

The fix in the last commit was surgical, but resulted in duplicating the
valid-duration check. This commit adds a new field to Entry that tracks
the precise nature of the error that occurred, so that the correct error
can be returned when `poll_elapsed` is called.
@benesch
Copy link
Contributor Author

benesch commented Dec 24, 2019

Thanks! Done.

Copy link
Member

@carllerche carllerche left a comment

Choose a reason for hiding this comment

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

Thanks 👍

@carllerche carllerche merged commit d1744bf into tokio-rs:master Jul 25, 2020
@benesch
Copy link
Contributor Author

benesch commented Jul 25, 2020

Thanks for the rebase + merge!

@Darksonn Darksonn added A-tokio Area: The main tokio crate C-enhancement Category: A PR with an enhancement or bugfix. M-time Module: tokio/time labels Jul 25, 2020
@Darksonn Darksonn mentioned this pull request Nov 10, 2020
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 C-enhancement Category: A PR with an enhancement or bugfix. M-time Module: tokio/time
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants