Skip to content

Tracking Issue for Duration saturating operations #76416

Closed

Description

@marmeladema

This is a tracking issue for Duration saturating operations.
The feature gate for the issue is #![feature(duration_saturating_ops)].

        impl Duration {
            pub const fn saturating_add(self, rhs: Duration) -> Duration {}
            pub const fn saturating_sub(self, rhs: Duration) -> Duration {}
            pub const fn saturating_mul(self, rhs: u32) -> Duration {}
        }

Steps

Unresolved Questions

  • Do we want associated constants similar to the ones that already exist for integer types or associated methods? (ie: Duration::MIN or Duration::min()?
  • Should Duration::MIN be replaced by Duration::zero()? They are currently equivalent but one can image a future where Duration is able to hold negative duration and thus making MIN different from zero().

Activity

  1. added
    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
    on Sep 6, 2020
  2. added
    I-libs-radarLibs issues that are tracked on the team's radar.
    on Nov 6, 2020
  3. matklad commented on Nov 12, 2020

    @matklad
    Contributor

    Just needed saturating_sub when dealing with time intervals.

    Also, unresloved questions seem to be from another tracking issue?

  4. m-ou-se commented on Mar 31, 2021

    @m-ou-se
    Member

    @rfcbot merge

  5. rfcbot commented on Mar 31, 2021

    @rfcbot

    Team member @m-ou-se has proposed to merge this. The next step is review by the rest of the tagged team members:

    No concerns currently listed.

    Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

    See this document for info about what commands tagged team members can give me.

  6. added
    proposed-final-comment-periodProposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off.
    disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.
    final-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.
    on Mar 31, 2021
  7. rfcbot commented on Mar 31, 2021

    @rfcbot

    🔔 This is now entering its final comment period, as per the review above. 🔔

  8. removed
    proposed-final-comment-periodProposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off.
    on Mar 31, 2021
  9. added and removed
    final-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.
    on Apr 10, 2021
  10. rfcbot commented on Apr 10, 2021

    @rfcbot

    The final comment period, with a disposition to merge, as per the review above, is now complete.

    As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

    The RFC will be merged soon.

  11. marmeladema commented on Apr 10, 2021

    @marmeladema
    ContributorAuthor

    I am very happy to see this stabilized. One thing I wanted to discuss is the documentation: it currently mentions two associated constants:

    But both are currently unstable. Should they be stabilized at the same time? Or should the documentation updated? It seems a bit weird that the documentation for stable methods is mentioning unstable features and therefore the code examples cannot be executed and verified on stable. This is really a newbie question, I don't know what is the correct approach here. I am pretty sure such circumstances have happened before?

    Also, once that question is resolved, I would be very glad to do the stabilization PR. It's my first tracking issue and it would kind of be a personal accomplishment 👍

  12. m-ou-se commented on Apr 11, 2021

    @m-ou-se
    Member

    ZERO is being stabilized at the same time: #73544 (comment)

    MAX still needs to be stabilized. Here it's suggested that that constant should probably not be part of the same tracking issue as the other constants there (SECOND, etc.). Feel free to send a PR that stabilizes just MAX, then we can do an FCP on that PR and we'll remove it from that tracking issue.

    Also, once that question is resolved, I would be very glad to do the stabilization PR.

    Feel free to make that PR without waiting for MAX. In this specific case I don't think it's a problem if this gets stabilized while the docs still refer to something unstable. MAX is pretty clear and uncontroversial. Even if it's unstable, it's still the best way we have to refer to the maximum value of a Duration. (And it'll probably be stable anyway in ~two weeks.)

  13. added 2 commits that reference this issue on Apr 11, 2021
    7d89148
    e26c936
  14. added a commit that references this issue on Apr 12, 2021
  15. added a commit that references this issue on Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-timeArea: `std::time`C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCI-libs-radarLibs issues that are tracked on the team's radar.T-libs-api[DEPRECATED; DO NOT USE]disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions