Skip to content

Commit 013f323

Browse files
authored
docs: add a missing panic scenario of time::advance (#7394)
1 parent b926700 commit 013f323

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tokio/src/time/clock.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,18 @@ cfg_test_util! {
185185
///
186186
/// # Panics
187187
///
188-
/// Panics if time is not frozen or if called from outside of the Tokio
189-
/// runtime.
188+
/// Panics if any of the following conditions are met:
189+
///
190+
/// - The clock is not frozen, which means that you must
191+
/// call [`pause`] before calling this method.
192+
/// - If called outside of the Tokio runtime.
193+
/// - If the input `duration` is too large (such as [`Duration::MAX`])
194+
/// to be safely added to the current time without causing an overflow.
195+
///
196+
/// # Caveats
197+
///
198+
/// Using a very large `duration` is not recommended,
199+
/// as it may cause panicking due to overflow.
190200
///
191201
/// # Auto-advance
192202
///

0 commit comments

Comments
 (0)