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

E0431: Inout keyword missing

CodeCategoryStability
E0431Struct and enumPermanent

Explanation

A call passes an argument to an inout parameter without the required inout mode: the argument is unmarked or is marked borrow. The call site must select exclusive mutable access exactly.

Likely cause

The callee's parameter was changed to inout, or the call uses no marker or the wrong marker. Add or replace the marker with inout before an addressable mutable argument, or change the parameter mode if mutation and write-back are not intended.

Examples

Omit the inout call-site marker

fn increment(inout value: i32) { value = value + 1; }
fn main() -> i32 {
    let mut value = 41;
    increment(value);
    value
}

Mark the exclusive argument

fn increment(inout value: i32) { value = value + 1; }
fn main() -> i32 {
    let mut value = 41;
    increment(inout value);
    value
}

References