Ruta graveolens  ·  notes from a language experiment  ·  cultivated since 2025

E0210: Str view reassignment

CodeCategoryStability
E0210SemanticPermanent

Explanation

Rue rejected whole-value assignment to an inout str view. The view may access caller-owned bytes, but its two-word view header is not an assignable string value.

Likely cause

Code inside a function with an inout str parameter tried to replace the parameter binding, such as text = "new". Mutate through operations supported by the view, or replace the caller's concrete buffer outside the view-taking function.

Examples

Reassign an exclusive string view

fn replace(inout text: str) {
    text = "new";
}
fn main() {
    let mut text: Str(8) = "old";
    replace(inout text);
}

Read through the view without rebinding it

fn length(inout text: str) -> u64 {
    text.len()
}
fn main() -> i32 {
    let mut text: Str(8) = "old";
    @intCast(length(inout text))
}

References