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

E0205: Use after move

CodeCategoryStability
E0205SemanticPermanent

Explanation

Rue found a use of a move-type value after ownership of that value had already been transferred.

Likely cause

A struct or another non-Copy value was assigned, passed by value, or returned and then used again. Use the new owner, borrow the original when ownership need not transfer, or reinitialize the moved place before reusing it.

Examples

Use after ownership moves

struct Point { x: i32 }
fn main() -> i32 {
    let point = Point { x: 42 };
    let moved = point;
    point.x
}

Use the new owner

struct Point { x: i32 }
fn main() -> i32 {
    let point = Point { x: 42 };
    let moved = point;
    moved.x
}

References