about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorLinus Färnstrand <faern@faern.net>2018-12-14 20:07:04 +0100
committerLinus Färnstrand <faern@faern.net>2018-12-14 21:49:50 +0100
commit496f547af604f5430ab6fbb3ce78ef0ea79a6ae8 (patch)
treee45c38a2bf48fac5ec3b7830d88e238720b55056 /src/libstd
parent018f8a027d47cce44aa90c97ae4baa069ebccc2c (diff)
downloadrust-496f547af604f5430ab6fbb3ce78ef0ea79a6ae8.tar.gz
rust-496f547af604f5430ab6fbb3ce78ef0ea79a6ae8.zip
Add documentation about panicking Add<Duration> impls
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/time.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libstd/time.rs b/src/libstd/time.rs
index 63cede79e48..5bac4f50f1f 100644
--- a/src/libstd/time.rs
+++ b/src/libstd/time.rs
@@ -230,6 +230,12 @@ impl Instant {
 impl Add<Duration> for Instant {
     type Output = Instant;
 
+    /// # Panics
+    ///
+    /// This function may panic if the resulting point in time cannot be represented by the
+    /// underlying data structure. See [`checked_add`] for a version without panic.
+    ///
+    /// [`checked_add`]: ../../std/time/struct.Instant.html#method.checked_add
     fn add(self, other: Duration) -> Instant {
         self.checked_add(other)
             .expect("overflow when adding duration to instant")
@@ -397,6 +403,12 @@ impl SystemTime {
 impl Add<Duration> for SystemTime {
     type Output = SystemTime;
 
+    /// # Panics
+    ///
+    /// This function may panic if the resulting point in time cannot be represented by the
+    /// underlying data structure. See [`checked_add`] for a version without panic.
+    ///
+    /// [`checked_add`]: ../../std/time/struct.SystemTime.html#method.checked_add
     fn add(self, dur: Duration) -> SystemTime {
         self.checked_add(dur)
             .expect("overflow when adding duration to instant")