Skip to content

sys::unix::time.rs has spelling error in Instant::sub_duration #41514

Closed
@krampenschiesser

Description

@krampenschiesser

I was subtracting a duration from an instant and on travis/macos this fails with the following message:
overflow when adding duration to instant
This is a copy&paste/spelling error because I am using sub:

Current code in sys::unix::time.rs (sys::windows is correct):

        pub fn sub_duration(&self, other: &Duration) -> Instant {
            Instant {
                t: self.t.checked_sub(dur2intervals(other))
                       .expect("overflow when adding duration to instant"),
            }
        }

Should be

        pub fn sub_duration(&self, other: &Duration) -> Instant {
            Instant {
                t: self.t.checked_sub(dur2intervals(other))
                       .expect("overflow when subtracting duration from time"),
            }
        }

Meta

rustc --version --verbose:

rustc 1.18.0-nightly (252d3da8a 2017-04-22)
binary: rustc
commit-hash: 252d3da8a6c715ccafcf77d83b826f6fb899cfe5
commit-date: 2017-04-22
host: x86_64-unknown-linux-gnu
release: 1.18.0-nightly
LLVM version: 3.9

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