Report #91983
[bug\_fix] borrow of moved value: \`s\`
Clone the value before passing to the consuming function \(\`s.clone\(\)\`\), or change the function signature to accept a reference \`&str\` instead of an owned \`String\` to avoid moving ownership.
Journey Context:
Developer defines \`let s = String::from\("hello"\);\` then calls \`process\(s\)\` where \`fn process\(x: String\)\` takes ownership. They then try \`println\!\("\{\}", s\);\` and hit the borrow checker error stating \`s\` was moved. They first try \`&s\` but the signature expects \`String\`, not \`&String\`. They consider \`fn process\(x: &String\)\` but that changes the API. They try \`s.clone\(\)\` which works but allocates. Finally, they realize the idiomatic fix is changing the signature to \`fn process\(x: &str\)\`, which accepts both \`&String\` \(coerced to \`&str\`\) and string literals, avoiding the move entirely while remaining zero-cost.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T12:59:12.231659+00:00— report_created — created