From 95e2bf253d864c5e14ad000ffa2040ce85916056 Mon Sep 17 00:00:00 2001
From: Claudio Bley <claudio.bley@gmail.com>
Date: Thu, 31 May 2018 22:05:36 +0200
Subject: [PATCH 1/2] Fix confusing error message for sub_instant

When subtracting an Instant from another, the function will panick when `RHS > self`, but the error message confusingly displays a different error:

```rust
let i = Instant::now();
let other = Instant::now();
if other > i {
    println!("{:?}", i - other);
}
```
This results in a panic:
```
thread 'test_instant' panicked at 'other was less than the current instant', libstd/sys/unix/time.rs:292:17
```
---
 src/libstd/sys/unix/time.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libstd/sys/unix/time.rs b/src/libstd/sys/unix/time.rs
index 8312793590993..f7459cb55d5ca 100644
--- a/src/libstd/sys/unix/time.rs
+++ b/src/libstd/sys/unix/time.rs
@@ -289,7 +289,7 @@ mod inner {
 
         pub fn sub_instant(&self, other: &Instant) -> Duration {
             self.t.sub_timespec(&other.t).unwrap_or_else(|_| {
-                panic!("other was less than the current instant")
+                panic!("other was greater than the current instant")
             })
         }
 

From 33c4b37d00985f8f12796ef1b0b8ff97a4f3db99 Mon Sep 17 00:00:00 2001
From: Claudio Bley <cbley@exa-online.de>
Date: Mon, 4 Jun 2018 08:58:55 +0200
Subject: [PATCH 2/2] Clarify error phrase in `sub_instant` function

Uses the same wording as [`src/libstd/sys/windows/time.rs`][1].

1: https://github.com/avdv/rust/blob/95e2bf253d864c5e14ad000ffa2040ce85916056/src/libstd/sys/windows/time.rs#L65
---
 src/libstd/sys/redox/time.rs | 2 +-
 src/libstd/sys/unix/time.rs  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libstd/sys/redox/time.rs b/src/libstd/sys/redox/time.rs
index cf798500b7fd2..5c491115c5516 100644
--- a/src/libstd/sys/redox/time.rs
+++ b/src/libstd/sys/redox/time.rs
@@ -144,7 +144,7 @@ impl Instant {
 
     pub fn sub_instant(&self, other: &Instant) -> Duration {
         self.t.sub_timespec(&other.t).unwrap_or_else(|_| {
-            panic!("other was less than the current instant")
+            panic!("specified instant was later than self")
         })
     }
 
diff --git a/src/libstd/sys/unix/time.rs b/src/libstd/sys/unix/time.rs
index f7459cb55d5ca..89786eb2a6c48 100644
--- a/src/libstd/sys/unix/time.rs
+++ b/src/libstd/sys/unix/time.rs
@@ -289,7 +289,7 @@ mod inner {
 
         pub fn sub_instant(&self, other: &Instant) -> Duration {
             self.t.sub_timespec(&other.t).unwrap_or_else(|_| {
-                panic!("other was greater than the current instant")
+                panic!("specified instant was later than self")
             })
         }