Sisu
E0068

Index of something that is not an array

Error

Built from the repository at commit a8614dc.

Only an array can be indexed: xs[i].

Why

A number, a bool or an object holds no elements, so there is nothing for an index to select.

Broken

fn main() {
    let n = 5
    print(n[0])
}

What sisu says

error[E0068]: cannot index `i64`
 --> E0068.sisu:3:11
  |
3 |     print(n[0])
  |           ^
  |
  = help: only arrays can be indexed

sisu: 1 error
sisu: for more on a code, run `sisu explain <code>`: E0068

Fixed

fn main() {
    let xs = [5]
    print(xs[0])
}