OxL Reference

error invalid-char-literal

error Standard: [§1.5]

What it means#

A character literal holds exactly one Unicode scalar value, written 'a', with an escape such as '\n' or '\u{1F600}' (§1.5). It differs from a loop label 'name (§1.3) by the closing apostrophe. An empty literal, several characters between apostrophes, or an invalid scalar value is reported.

Example#

oxl✓ checked in CI
fn main() {
  let c = 'ab'      // <- invalid-char-literal
}
error
invalid-char-literal

How to fix#

oxl✓ checked in CI
fn main() {
  let c = 'a'
  let s = "ab"
}

Use a str literal for more than one character, or keep exactly one scalar value between the apostrophes.

See also#

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