Skip to content

Wrong documentation for Instant::elapsed #103282

Closed
@Lancern

Description

@Lancern

Location

/// Returns the amount of time elapsed since this instant was created.
///
/// # Panics
///
/// Previous rust versions panicked when self was earlier than the current time. Currently this
/// method returns a Duration of zero in that case. Future versions may reintroduce the panic.
/// See [Monotonicity].

Summary

This is part of the documentation for std::time::Instant::elapsed. The Panics section on line 359 says:

Previous rust versions panicked when self was earlier than the current time.

Which is obviously not the case. It should be:

Previous rust versions panicked when the current time was earlier than self.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions