Skip to content

Incorrect behaviour of strings.substring_from according to documentation #6059

@AntonGorov195

Description

@AntonGorov195

Context

Odin: dev-2025-08:fb4641307
OS: Linux Mint 22.1, Linux 6.8.0-90-generic
CPU: Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz
RAM: 15929 MiB
Backend: LLVM 20.1.8

According to substring_from documentation at core:strings line 3448 (3444 on my Odin version)

Think of it as slicing s[rune_start:] but rune-wise.

This is false.

package substring

import "core:strings"

main :: proc() {
    assert("a"[1:] == "", "string slicing failed") // empty string
    _, ok := strings.substring_from("a", 1)
    assert(ok, "substring_from failed")
}

Expected Behavior

runtime assertion: string slicing failed or

Current Behavior

runtime assertion: substring_from failed

Steps to Reproduce

Run the above code with odin run .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions