Skip to content

Strengthen/clarify "It is an error to..." wording #48311

Closed
@frewsxcv

Description

@frewsxcv

For all of the APIs above, the docs have a line with this wording:

It is an error to pass the zero Duration to this method.

My initial thought is, what does "it is an error" mean? Does this mean the API will panic if Some(Duration::from_secs(0)) is passed or will it just return an Err? The answer appears to be the latter.

Also since it's the latter, and we don't have an explicit check for Duration(0) in our codebase, it means we're relying on the behavior being the same across all platforms. Is this alright? Should/can we add an explicit check for Duration(0)? Should we add a test ensuring this is the behavior across all platforms?

Maybe I'm overthinking this...

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions