Illustrates a move-related ownership error.

Section: Common error patterns

Borrow after move example

rust
rust
let name = String::from("cli");
let moved = name;
println!("{}", name);
Explanation

After moving `name` into `moved`, using `name` again triggers an ownership error.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Common error patterns
Type mismatch example
A classic mismatched-type error.
OpenIn sheetrustsame section
Missing trait import example
Method exists but the trait is not in scope.
OpenIn sheetrustsame section
Use `?` with a fallible function
Return a compatible `Result` when using the question-mark operator.
OpenIn sheetrustsame section
Run a fast compile check
Type-check without producing final binaries.
Build with verbose output
Show additional build detail from Cargo.
Build with very verbose output
Show even more detail from Cargo.