P0035

String.slice was given indices out of bounds: a start or end below 0 or past the text's length in characters, or a start past the end. Spans the call. Indices count characters (Unicode code points), not bytes.

Machine-applicable fix: none.

Example

This program fails with P0035.

fn main() {
    let part = "abc".slice(0, 10)
}

Fixed

The same program, fixed.

fn main() {
    let part = "abc".slice(0, 2)
}

Listed in the runtime notes. oskac explain P0035 prints this entry offline.

All error codes