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

make Instant::{duration_since, elapsed, sub} saturating and remove workarounds #89926

Merged
merged 4 commits into from
Feb 13, 2022

Commits on Feb 13, 2022

  1. make Instant::{duration_since, elapsed, sub} saturating and remove wo…

    …rkarounds
    
    This removes all mutex/atomics based workarounds for non-monotonic clocks and makes the previously panicking methods saturating instead.
    
    Effectively this moves the monotonization from `Instant` construction to the comparisons.
    
    This has some observable effects, especially on platforms without monotonic clocks:
    
    * Incorrectly ordered Instant comparisons no longer panic. This may hide some programming errors until someone actually looks at the resulting `Duration`
    * `checked_duration_since` will now return `None` in more cases. Previously it only happened when one compared instants obtained in the wrong order or
      manually created ones. Now it also does on backslides.
    
    The upside is reduced complexity and lower overhead of `Instant::now`.
    the8472 committed Feb 13, 2022
    Configuration menu
    Copy the full SHA
    9d8ef11 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    bda2693 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    376d955 View commit details
    Browse the repository at this point in the history
  4. Capitalize "Rust"

    Co-authored-by: Mark Rousskov <mark.simulacrum@gmail.com>
    2 people authored and the8472 committed Feb 13, 2022
    Configuration menu
    Copy the full SHA
    37a1fc5 View commit details
    Browse the repository at this point in the history