Skip to content
Playground(another site)

bynk.duration.literal_overflow

Error A Duration literal (<int>.<unit>) exceeds the representable millisecond range.

5.minutes is a Duration, which the compiler stores as a whole number of milliseconds, so it multiplies the count by the unit when it reads the literal. A count whose total does not fit in a 64-bit integer is refused rather than wrapped into a wrong or negative span. No real timeout or interval is that large: write a smaller count, or a smaller unit.

Example

fn forever() -> Duration { 9007199254740991.days } // ✗ overflows the millisecond range
fn forever() -> Duration { 365.days } // ✓

In the Book

See also

  • Every code in its category, Other, on the diagnostic index.
  • bynk explain bynk.duration.literal_overflow shows the same from the installed toolchain, without a network.