OxL Reference

error invalid-number

error Standard: [§1.5]

What it means#

Integer and floating-point literals must follow §1.5: decimal, 0x, 0o and 0b forms with digits valid for the base, _ as a separator between digits, an optional exponent, and an optional type suffix such as u8 or f32. Digits out of range for the base, a missing digit after the prefix, or a misplaced _ make the literal malformed. (A well-formed literal that does not fit its type is literal-overflow.)

Example#

oxl✓ checked in CI
fn main() {
  let mask = 0b1021      // <- invalid-number (2 is not a binary digit)
}
error
invalid-number

How to fix#

oxl✓ checked in CI
fn main() {
  let mask = 0b1011
}

Use only digits of the chosen base, put a digit after 0x, 0o or 0b, and keep _ between digits (1_000, not 1000_).

See also#

OxL 1.0.0-beta · Documentation version 1.0.0-beta© OxwaldLink · generated from the Standard, the std sources and the guides