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

E0203: Assign to immutable

CodeCategoryStability
E0203SemanticPermanent

Explanation

Rue rejected an assignment because its target belongs to a binding that was not declared mutable.

Likely cause

A variable, array, or struct value was introduced with let and later used as an assignment target. Bind it with let mut when mutation is intended.

Examples

Assignment to an immutable binding

fn main() -> i32 {
    let value = 0;
    value = 42;
    value
}

Declare the binding mutable

fn main() -> i32 {
    let mut value = 0;
    value = 42;
    value
}

References