Skip to content
Playground(another site)

bynk.duration.unknown_unit

Error An integer literal is followed by a word that is not a Duration unit.

An integer literal has no fields, so a word after one (5.hr) is always read as the unit of a Duration literal. The units are millisecond(s), second(s), minute(s), hour(s) and day(s); there is no week. The diagnostic lists them and suggests the nearest one. Write the unit out in full, in the form that agrees with the number (1.hour, 5.hours).

Example

fn wait() -> Duration { 5.hr } // ✗ `hr` is not a unit
fn wait() -> Duration { 5.hours } // ✓

See also

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