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

Wrong documentation for Instant::elapsed #103282

Closed
Lancern opened this issue Oct 20, 2022 · 0 comments · Fixed by #103288
Closed

Wrong documentation for Instant::elapsed #103282

Lancern opened this issue Oct 20, 2022 · 0 comments · Fixed by #103288
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools

Comments

@Lancern
Copy link

Lancern commented Oct 20, 2022

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.

@Lancern Lancern added the A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools label Oct 20, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 20, 2022
Fixed docs typo in `library/std/src/time.rs`

* Changed comment from `Previous rust versions panicked when self was earlier than the current time.` to `Previous rust versions panicked when the current time was earlier than self.`
* Resolves rust-lang#103282.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 20, 2022
Fixed docs typo in `library/std/src/time.rs`

* Changed comment from `Previous rust versions panicked when self was earlier than the current time.` to `Previous rust versions panicked when the current time was earlier than self.`
* Resolves rust-lang#103282.
@bors bors closed this as completed in c6a680e Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant